4 Replies
      Latest reply on Oct 13, 2019 10:22 AM by Kryption LLC
      Kryption LLC Level 1 Level 1 (0 points)



        Given the following example:


        let privateKeyA = P521.KeyAgreement.PrivateKey() //Stored locally on device

        let publicKeyA = privateKeyA.publicKey

        let publicKeyAString = publicKeyA.rawRepresentation.base64EncodedString() //Stored on the server


        My question is how do I later convert the publicKeyAString back into a proper publicKey of type: "P521.KeyAgreement.PublicKey"


        With the end goal of something like:


        let sharedSecret = try? privateKeyB.sharedSecretFromKeyAgreement(with: publicKeyA)