In order to pass data between our server and yours we use the Advanced Encryption Standard (AES 256), which is a symmetric encryption algorithm and one of the most secure currently available.
For example, to retrieve the PIN, you must retrieve the encrypted pin data by using the ViewPin API method. After receiving the data, the data is decrypted using AES256 algorithm with the appropriate IV and secret key.
Note: You receive the Encryption/Decryption keys in the response of the Login method as a Security key parameter.
Contis will pass information such as a virtual payment card CVV (security code) in encrypted format. Any encrypted information can be decrypted using a unique key provided to you by Contis.
Encrypt the data
To encrypt the data, use the AES256 algorithm. The C# code (shown below) helps you to encrypt the data. This function is used to encrypt data using the Security Key.
publicbyte FromHexString(String hex)
byte bts = newbyte[hex.Length / 2];
for (int i = 0; i < bts.Length; i++)
bts[i] = (byte)Convert.ToInt32(hex.Substring(2 * i, 2), 16);
publicstringEncrypt(string PlainValue, string securityKey)
byte iv = FromHexString(securityKey.Remove(32, 64));
byte key = FromHexString(securityKey.Remove(0, 32));
returnAES256Encrypt(PlainValue, key, iv);
publicstringAES256Encrypt(string clearText, byte key, byte iv)
AesCryptoServiceProvider aesCipher = new AesCryptoServiceProvider();
byte plainText = System.Text.Encoding.Unicode.GetBytes(clearText);
ICryptoTransform encryptor = aesCipher.CreateEncryptor(key, iv);
using (MemoryStream msEncrypt = new MemoryStream())
//Defines a stream that links data streams to cryptographic transformations using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
csEncrypt.Write(plainText, 0, plainText.Length);
//Writes the final state and clears the buffer
byte cipherBytes = msEncrypt.ToArray();
string encryptedData = Convert.ToBase64String(cipherBytes);