I’ve been trying to use this code to create a public key that I can use in an Android app.
[code] Dim privateKey As String
Dim publicKey As String
Dim DER As MemoryBlock
If Crypto.RSAGenerateKeyPair( 1024, privateKey, publicKey ) Then
if Crypto.RSAVerifyKey(publicKey) then
DER = Crypto.DEREncodePublicKey(publicKey)
publicKey = EncodeBase64(DER)
end
txtPublic.Text = "PUBLIC KEY:" + EndOfLine + (publicKey)
txtPrivate.Text = "PRIVATE KEY:" + EndOfLine + (privateKey)
end[/code]
The public key that this creates throws an invalid key exception in Android. I know it’s a long shot but is there anyone in here that could give me some advice? Thanks.
It will use the key to encrypt a message for a Xojo app. I haven’t got that far because I can’t get Android to accept the key that is generated by Xojo so I can try to use it. The KeyFactory as it’s called in Java can’t seem to create the public key from the Xojo format. I’m using X509EncodedKeySpec which is supposed to want DER. Although I have tried using just the RSA key encoded to base 64 and that doesn’t work either. Thanks for the reply.
@Greg O’Lone I was just advised that I need to generate a key using the SubjectPublicKeyInfo format (see RFC 5280). Can you tell me how to do that in Xojo? Thanks!
@Greg O’Lone I finally got the public Key generated by Xojo converted in Android into a public key it could use. I encrypted a test message with it and now Xojo is giving me an error:
Does this mean Xojo is looking for this algorithm or does it mean my ciphertext is encrypted with this algorithm?
Which algorithm combination should I be using for Crypto.RSADecrypt? Thanks!
Really? You know I sure am tired of being scolded on the internet. If someone wanted to know how to do this all they had to do was ask. Here’s the thread from stackoverflow where I took another scolding yesterday just for asking a valid question.
It wasn’t a Xojo solution, it was an Android issue, but if I could have got an answer to my last post on here, about what the error meant I was getting in Xojo, it would have made it a lot easier to figure out.
[quote=226377:@Ryan Haynes]Really? You know I sure am tired of being scolded on the internet. If someone wanted to know how to do this all they had to do was ask. Here’s the thread from stackoverflow where I took another scolding yesterday just for asking a valid question.
It wasn’t a Xojo solution, it was an Android issue, but if I could have got an answer to my last post on here, about what the error meant I was getting in Xojo, it would have made it a lot easier to figure out.[/quote]
Aren’t we a bit unfair here ? I have seen time and again people try their best to assist you in the forum. Maybe you spent too much time in SO …
With such reactions, you are certainly not encouraging others to help you anymore.
[/quote][quote=226414:@Michel Bujardet]Aren’t we a bit unfair here ? I have seen time and again people try their best to assist you in the forum. Maybe you spent too much time in SO …
With such reactions, you are certainly not encouraging others to help you anymore.[/quote]
Are you looking for a fight or something? I’ve been posting on here since the old forums, look up my posts on there waveuponwave and I have answered many questions, and asked many questions. I posted the answer you asked me for didn’t I? I don’t recall anyone making you the forum police. That’s my only point. Nothing more. Let’s just chill out now. K?
[quote=226415:@Ryan Haynes][/quote]
Are you looking for a fight or something? I’ve been posting on here since the old forums, look up my posts on there waveuponwave and I have answered many questions, and asked many questions. I posted the answer you asked me for didn’t I? I don’t recall anyone making you the forum police. That’s my only point. Nothing more. Let’s just chill out now. K?[/quote]