What works:
- Generate RSA keys via php & OpenSSL
- store the keys in a MySQL table
- retrieve the keys and encrypt/decrypt data
On the B4A side:
- retrieve the *same* public key (via php)
- load the key
- encrypt & send a message
Problem:
- I can't decrypt the message via openssl_private_decrypt (message is just "can't decrypt")
Conclusion:
I can en-/decrypt on the serverside. The server-key can be used in b4a's encryption lib. So this must be a encoding/padding thing.
Any ideas?
- Generate RSA keys via php & OpenSSL
- store the keys in a MySQL table
- retrieve the keys and encrypt/decrypt data
On the B4A side:
- retrieve the *same* public key (via php)
- load the key
- encrypt & send a message
Problem:
- I can't decrypt the message via openssl_private_decrypt (message is just "can't decrypt")
B4X:
mess="Hallo"
MessageBytes = Bconv.StringToBytes(mess, "UTF8")
MessageBytesEncrypted = c.encrypt(MessageBytes, ForeignKPG.PublicKey, False)
MessageStringEncrypted=Bconv.StringFromBytes(MessageBytesEncrypted,"UTF8")
MessageStringEncrypted=su.EncodeBase64(MessageBytesEncrypted)
Dim DeCryptM As HttpJob
DeCryptM.Initialize("DeCryptM", Me)
DeCryptM.Download2("http://192.168.178.21/rsa/RSASql.php", _
Array As String("Action", "DeCryptM", "Mess", MessageStringEncrypted ))
Conclusion:
I can en-/decrypt on the serverside. The server-key can be used in b4a's encryption lib. So this must be a encoding/padding thing.
Any ideas?