PTA errors using Syndicated Conditional Chat Link

Tags: 

I'm simply attempting to implement the SCCL using PTA with encryption and cannot get past encryption issues. I'm using .NET in C# to construct up the encoded/encrypted login string using AesCryptoServiceProvider and it simply will not work. I'm getting errors 3 and 9 seemingly randomly even when my code doesn't change. Really frustrating.

Here is what I have...

Config on the server:

PTA_ENCRYPTION_METHOD = aes256
PTA_ENCRYPTION_KEYGEN = 2 (RSSL_KEYGEN_NONE)
PTA_SECRET_KEY = <16 byte value>
PTA_ENCRYPTION_PADDING = 5 (RSSL_PAD_ANSIX923)
PTA_ENCRYPTION_IV=<blank>
PTA_ENCRYPTION_SALT=<blank>

Login string is: "p_userid=keffner"<br/>

byte[] textBytes = Encoding.UTF8.GetBytes(LoginString);

using (AesCryptoServiceProvider csp = new AesCryptoServiceProvider())
{
csp.Mode = cec.CipherMode;
csp.KeySize = cec.KeySize;
csp.Padding = cec.PaddingMode;
//csp.Key = cec.GenerateSecretKey();
csp.IV = new byte[16];

// Overestimate encrypted size requirements
byte[] encryptedDataBuffer = new byte[loginBytes.Length + 32];
MemoryStream encryptedOutput = new MemoryStream(encryptedDataBuffer, true);

CryptoStream encStream = new CryptoStream(encryptedOutput, csp.CreateEncryptor(),
CryptoStreamMode.Write);
encStream.Write(textBytes, 0, textBytes.Length);

encStream.FlushFinalBlock();
byte[] encryptedData = new byte[encryptedOutput.Position];
Array.Copy(encryptedDataBuffer, encryptedData, encryptedData.Length);
encStream.Close();

return encryptedData;

I'm using the following to encode the encrypted string:

string encodedChatLogin = Convert.ToBase64String(Encrypt(chatLogin));

Any help/guidance appreciated!
Tom

Zircon - This is a contributing Drupal Theme
Design by WeebPal.