cryptography icon indicating copy to clipboard operation
cryptography copied to clipboard

How to convert a string version of public key to PublicKey object for diffie Hellman

Open NeonPokharkar opened this issue 3 years ago • 2 comments

NeonPokharkar avatar Jan 31 '22 20:01 NeonPokharkar

I am using node js server to send it's public key to the flutter app, but it returns the value as a string, how to deal with that?

NeonPokharkar avatar Jan 31 '22 20:01 NeonPokharkar

Hello send the publickey from nodejs server as base64 encoded and decode it in your flutter app side then use the constructor of SimplePublicKey(public key decoded as bytes , type of the algorithm you use)

final type = DartX25519().keyPairType;
final spk = SimplePublicKey(publicKeyDecoded , type);

safwanolaimat avatar Mar 04 '22 00:03 safwanolaimat