Hey,
why is this code working on B4J, but not on B4A?
on B4A the output is allways the same, on B4J the right key is generated and i can decrypt it, but on B4A not.
why is this code working on B4J, but not on B4A?
B4X:
Private Sub EncryptRSAWithPublicKey(Text As String,PublicKey As String) As String
Dim su As StringUtils
Dim pubkey() As Byte = su.DecodeBase64(PublicKey)
Dim Enc As Cipher
Enc.Initialize("RSA")
Dim kpg As KeyPairGenerator
kpg.Initialize("RSA", 1024)
kpg.PublicKeyFromBytes(pubkey)
Dim bytes() As Byte = Text.GetBytes("UTF8")
Return su.EncodeBase64(Enc.Encrypt(bytes,kpg.PublicKey,False))
End Sub
on B4A the output is allways the same, on B4J the right key is generated and i can decrypt it, but on B4A not.
Last edited: