public static string DecryptData(string dataString, ICipherParameters key) { var decData = Convert.FromBase64String(dataString); var data = RSA_NONE_PKCS1Padding.Encrypt(decData, key); return(Encoding.UTF8.GetString(data)); }
public static string EncryptData(string dataString, ICipherParameters key) { var encData = Encoding.UTF8.GetBytes(dataString); var data = RSA_NONE_PKCS1Padding.Encrypt(encData, key); return(Convert.ToBase64String(data)); }
public static string DecryptData(string dataString, string cert, string certPwd) { var certificate = GetSignCertificate(cert, certPwd); return(RSA_NONE_PKCS1Padding.Decrypt(dataString, certificate.key)); }
public static string EncryptPin(string pin, string card, AsymmetricKeyParameter key) { var pinBlock = Pin2PinBlockWithCardNO(pin, card); return(Convert.ToBase64String(RSA_NONE_PKCS1Padding.Encrypt(pinBlock, key))); }