In PHP language, the C# ASCII code equivalent is expressed as
I want to implement this code for bank payment in PHP. Can anyone help me? Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ASCIIEncoding ByteConverter = new ASCIIEncoding();
string dataString = "Data to Sign" ;
byte[] originalData = ByteConverter.GetBytes(dataString);
byte[] signedData;
RSACryptoServiceProvider RSAalg = new RSACryptoServiceProvider();
String PrivateKey= File.ReadAllText(Application.StartupPath + "PrivateKey.xml" );
RSAalg.FromXmlString(PrivateKey);
signedData = Key.SignData(originalData,SHA1.Create());
String base64String = Convert.ToBase64String(signedData, 0, signedData.Length);
|
I've tried this but didn't get any results. Due to a problem with the request, I got a symbol error.
1 2 3 4 5 6 7 8 9 | $baseString = "Data to Sign" ;
$signedData = null;
$privateKey = file_get_contents (config_path( "PrivateKey.pem" ));
$privateKeyResource = openssl_pkey_get_private( $privateKey );
$signature = null;
if (openssl_sign( $baseString , $signedData , $privateKeyResource , OPENSSL_ALGO_SHA1))
$signature = base64_encode ( $signedData );
|