I got a big issue. This cousing me to try some workarounds and all I tried drive me in anycase in a dead road…
I got a php code to generate am RSA Key Pair (PEM pcks#1 format) and I SIgn a passphrase with private Key… and the code is working…
$data = 'my data to sign';
include("Crypt/RSA.php");
$rsa = new Crypt_RSA();
$rsa->setPrivateKeyFormat(CRYPT_RSA_PRIVATE_FORMAT_PKCS1);
$rsa->setPublicKeyFormat(CRYPT_RSA_PUBLIC_FORMAT_PKCS1);
extract($rsa->createKey());
$plaintext = $data;
$rsa->loadKey($privatekey);
$signature = $rsa->sign($plaintext);
$rsa->loadKey($publickey);
echo $rsa->verify($plaintext, $signature) ? 'verified' : 'unverified';
echo "<br/>pubkey: ". $publickey."<br/>";
echo "signature:" . base64_encode($signature);
For testing porpouse I copied the publick key and the signature into my Xojo App where I need to verify the same passphrase with the publick key.
I followed some hints I get from the forum (like function to convert the PEM KEY format into a readeable xojo format), but unfortunately I can’t be able to have a succesfull signature verification.
Does anyone has aleady solved this situation ?
I tried to apply some workarounds using xojo code server side to have compatible keys and signature to use client side, but with Linux and Xojo I got so many issue the workarounds become the worst way…
Thanks
C
Verify into XOjo client:
[code] Dim PublicKey as String
DIM message as String = “my data to sign”
//get the signature
Dim Signature As String = DecodeBase64(TextArea_Signature.Text.Trim)
Dim mPK as MemoryBlock
//get the publick key and decode from PEM format
if DecodePEMPublicKey(TextArea_PK.text.trim,mPK) then
PublicKey = mpk.ToString
end if
If Crypto.RSAVerifySignature(message,Signature,PublicKey) Then
MsgBox("Signature test passed")
Else
MsgBox("Signature test failed")
End If[/code]
I got always ‘Signature test failed’ message