Post marked as solved
Post marked as solved with 7 replies, 2,566 views
Hi,
How do I generate the pem representation of a curve25519 public key? I can generate the key using :
let privateKey = Curve25519.KeyAgreement.PrivateKey()
let publicKey = privateKey.publicKey
print(publicKey.rawRepresentation.base64EncodedString())
This prints a string like this :
GyQfzi3bLfpDpzi8e9j6lovX15EZY1t1fQQcnJlURxI=
But the expected strings are more like :
----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEApxUNh3jHlNSAWE7fadipsh9AjXv6439VY3EWEC5kbgY=\n-----END PUBLIC KEY
Even if I add the
" -----BEGIN PUBLIC KEY-----"
and
"-----END PUBLIC KEY-----"
tags, it still doesn't process the key.
So what format is exactly the base64 encoded string of the raw format of curve25519 public key? And how do I generate the public key pem format?
The requirement is for Swift iOS.