protected string ShowDLNumber(byte[] dlByte, Int32 principalId) { string dlNumberOutput; try { if (dlByte != null) { Logic.Crypt crypto1 = new Logic.Crypt(); crypto1.CryptType = "DL"; crypto1.CryptData = PWDTK.Utf8BytesToString(dlByte); crypto1.Purpose = "29dc7202-ae1f-4d38-9694-9d700a94897b"; crypto1.AdditionalData = principalId.ToString(); byte[] dlBytes = crypto1.Unprotect(); return PWDTK.Utf8BytesToString(dlBytes); } else { return null; } } catch (System.Exception ex) { _newLogic.WriteExceptionToDB(ex, "ShowDLNumber"); return null; } }
protected string ShowSsn(byte[] ssnByte, Int32 principalId) { try { if (ssnByte != null) { Logic.Crypt crypto2 = new Logic.Crypt(); crypto2.CryptType = "SSN"; crypto2.CryptData = PWDTK.Utf8BytesToString(ssnByte); crypto2.Purpose = "86d4b5b2-b34a-4968-9fde-f8ed677bca8b"; crypto2.AdditionalData = principalId.ToString(); byte[] ssnBytes = crypto2.Unprotect(); return PWDTK.Utf8BytesToString(ssnBytes); } else { return null; } } catch (System.Exception ex) { _newLogic.WriteExceptionToDB(ex, "ShowSsn"); return null; } }
protected string ShowDebitCard(byte[] cardByte, Int32 cardId) { try { if (cardByte != null) { Logic.Crypt crypto1 = new Logic.Crypt(); crypto1.CryptType = "Card"; crypto1.Purpose = "9c443c6a-87d5-47cc-9c4d-abf6a2bd2e06"; crypto1.CryptData = PWDTK.Utf8BytesToString(cardByte); crypto1.AdditionalData = cardId.ToString(); byte[] cardNumberBytes = crypto1.Unprotect(); return PWDTK.Utf8BytesToString(cardNumberBytes); } else { return null; } } catch (System.Exception ex) { _newLogic.WriteExceptionToDB(ex, "ShowDebitCard"); return null; } }
protected string ShowAccountNumber(byte[] accountByte, Int32 accountId) { try { if (accountByte != null) { Logic.Crypt crypto1 = new Logic.Crypt(); crypto1.CryptType = "Account"; crypto1.Purpose = "4742b06b-9e12-48cf-9034-aadb15dc7a58"; crypto1.CryptData = PWDTK.Utf8BytesToString(accountByte); crypto1.AdditionalData = accountId.ToString(); byte[] accountNumberBytes = crypto1.Unprotect(); return PWDTK.Utf8BytesToString(accountNumberBytes); } else { return null; } } catch (System.Exception ex) { _newLogic.WriteExceptionToDB(ex, "MaskAccountNumber"); return null; } }
protected string MaskDLNumber(byte[] dlByte, Int32 principalId) { string dlNumberOutput; try { if (dlByte != null) { Logic.Crypt crypto1 = new Logic.Crypt(); crypto1.CryptType = "DL"; crypto1.CryptData = PWDTK.Utf8BytesToString(dlByte); crypto1.Purpose = "29dc7202-ae1f-4d38-9694-9d700a94897b"; crypto1.AdditionalData = principalId.ToString(); byte[] dlBytes = crypto1.Unprotect(); string dlNumber = PWDTK.Utf8BytesToString(dlBytes); if (!String.IsNullOrEmpty(dlNumber)) { if (dlNumber.Length == 1) { dlNumberOutput = "*"; } else if (dlNumber.Length == 2) { dlNumberOutput = "**"; } else if (dlNumber.Length <= 6) { dlNumberOutput = dlNumber.Substring(0, 1); for (int i = 0; i <= dlNumber.Length - 2; i++) { dlNumberOutput += "*"; } dlNumberOutput += dlNumber.Substring(dlNumber.Length - 1, 1); } else { dlNumberOutput = dlNumber.Substring(0, 1); for (int i = 0; i <= dlNumber.Length - 5; i++) { dlNumberOutput += "*"; } dlNumberOutput += dlNumber.Substring(dlNumber.Length - 4, 4); } return dlNumberOutput; } else { return null; } } else { return null; } } catch (System.Exception ex) { _newLogic.WriteExceptionToDB(ex, "MaskDLNumber"); return null; } }
protected string MaskDebitCard(byte[] cardByte, Int32 cardId) { string cardNumberOutput = ""; try { if (cardByte != null) { Logic.Crypt crypto1 = new Logic.Crypt(); crypto1.CryptType = "Card"; crypto1.Purpose = "9c443c6a-87d5-47cc-9c4d-abf6a2bd2e06"; crypto1.CryptData = PWDTK.Utf8BytesToString(cardByte); crypto1.AdditionalData = cardId.ToString(); byte[] cardNumberBytes = crypto1.Unprotect(); string cardNumber = PWDTK.Utf8BytesToString(cardNumberBytes); cardNumberOutput += cardNumber.Substring(0, 6); for (int i = 0; i <= cardNumber.Length - 10; i++) { cardNumberOutput += "*"; } cardNumberOutput += cardNumber.Substring(cardNumber.Length - 10, 4); return cardNumberOutput; } else { return null; } } catch (System.Exception ex) { _newLogic.WriteExceptionToDB(ex, "MaskDebitCard"); return null; } }
protected string MaskAccountNumber(byte[] accountByte, Int32 accountId) { string accountNumberOutput = ""; try { if (accountByte != null) { Logic.Crypt crypto1 = new Logic.Crypt(); crypto1.CryptType = "Account"; crypto1.Purpose = "4742b06b-9e12-48cf-9034-aadb15dc7a58"; crypto1.CryptData = PWDTK.Utf8BytesToString(accountByte); crypto1.AdditionalData = accountId.ToString(); byte[] accountNumberBytes = crypto1.Unprotect(); string accountNumber = PWDTK.Utf8BytesToString(accountNumberBytes); for (int i = 0; i <= accountNumber.Length - 4; i++) { accountNumberOutput += "*"; } accountNumberOutput += accountNumber.Substring(accountNumber.Length - 4, 4); return accountNumberOutput; } else { return null; } } catch (System.Exception ex) { _newLogic.WriteExceptionToDB(ex, "MaskAccountNumber"); return null; } return accountNumberOutput; }