Exemple #1
0
        private static Request BuildRequest(string data)
        {
            DataSecurity.RSA rsa = new DataSecurity.RSA();
            rsa.PublicKey = _publicKey;
            rsa.OEAP = true;
            rsa.KeySize = 256;

            _aes = new DataSecurity.AES();
            //aes.IV = aes.GenerateIV();
            _aes.IV = "1234567812345678"; //Must be 16 bytes
            _aes.SaltValue = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";//"20160928"; //Any string
            _aes.Passphrase = "AESPassword20160925BrianSpencer!"; //"BrianSpencer"; //Any string
            _key = _aes.GenerateKey();

            Request reqst = new Request();
            reqst.Action = "Referral";
            reqst.Data = _aes.Encrypt(data, _key);
            reqst.IV = rsa.Encrypt(_aes.IV);
            reqst.Key = rsa.Encrypt(_key);

            return reqst;
        }