Topic by Yiannis Evaggeliou
Hello All,
We are trying to set PTA with encryption aes256 for an interface we have.
Currently we are receiving Error 5, which is "The p_userid string was passed in, but it did not have a value. This pair is required for login."
Our Settings in RN Agent Desktop:
PTA_ENCRYPTION_KEYGEN: value 3-RSSL_KEYGEN_NONE
PTA_ENCRYPTION_METHOD: aes256-256 bit AES in CBC MODE
PTA_ENCRYPTION_PADDING: value 3-RSSL_PAD_ZERO
We also have PTA_IGNORE_CONTACT_PASSWORD=Yes
We have set the PTA_Secret_key equals 'voyotest'
Below is the code that we are using
<?php
//start the session
session_start();
$username = $_SESSION['username'];
$password = $_SESSION['password'];
$email = $_SESSION['email'];
$firstname = $_SESSION['firstname'];
if ($firstname == ""){
$tmpfn = explode('@',$email);
$firstname = $tmpfn[0];
}
$lastname = $_SESSION['lastname'];
if ($lastname == ""){
$tmpln = explode('@',$email);
$lastname = $tmpln[0];
}
$contact_type = $_SESSION['contact_type'];
//echo $contact_type;
//$ptaDataString = $_SESSION['ptaDataString'];
//echo $ptaDataString;
$ptaDataArray = array(
'p_userid' => $username,
'p_passwd' => $password,
'p_email.addr' => $email,
'p_name.first' => $firstname,
'p_name.last' => $lastname
);
//Convert PTA data array to string
$ptaDataString = "";
$comma_separated = implode(",", $ptaDataArray);
//echo $comma_separated; // lastname,email,phone
foreach($ptaDataArray as $key=>$value)
{
$ptaDataString .= ($ptaDataString === "") ? '' : '&';
$ptaDataString .= "$key=$value";
}
//echo $ptaDataString;
//if(PTA_ENCRYPTION_METHOD IS set)
//{
$ptaDataString = urldecode(http_build_query($ptaDataArray));
$ptaDataString = encryptData($ptaDataString);
//}
//Base64 encode the data
$ptaDataString = base64_encode($ptaDataString);
//Make sure the data is URL safe
$ptaDataString = strtr($ptaDataString, array('+' => '_', '/' => '~', '=' => '!'));
//Send the user to the PTA controller to log them in
header("Location: http://cognity.rightnowdemo.com/ci/pta/login/redirect/home/p_li/$ptaDataString");
function encryptData($input) {
$ptaKey = 'voyotest';
$iv = '\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0';
$encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $ptaKey, $input, MCRYPT_MODE_CBC, $iv);
return $encrypted;
}
exit;
?>
We can assume that there is some error in the encryption of PTA string which causes the error 5.
Can you indicate as which is this error?