> string ephemeralPubKey64 = > "BPhVspn70Zj2Kkgu9t8+ApEuUWsI/zos5whGCQBlgOkuYagOis7" > "qsrcbQrcprjvTZO3XOU+Qbcc28FSgsRtcgQE="; > StringSource ssECPoint(ephemeralPubKey64, true, new Base64Decoder > ); > > DL_GroupParameters_EC<ECP> params(CryptoPP::ASN1::secp256r1()); > ECP::Point point; > > if (!params.GetCurve().DecodePoint(point, ssECPoint, (size_t) > ssECPoint.MaxRetrievable())) > std::cerr << "Invalid decoding" << endl; > > ECIES<ECP>::PublicKey ephemeralPubKey; > ephemeralPubKey.Initialize(params, point); > > ephemeralPubKey.ThrowIfInvalid(prng, 3); > > cout << "Public key appears to be valid" << endl; > > But still need to figure out how to pass it to Decryptor >
Decryptors use the private key; Encryptor's use the public key. Its not readily apparent... the way to work with an ephemeral public key is detailed at "Ephemeral Key as (x,y)" under the ECDH page, http://www.cryptopp.com/wiki/Elliptic_Curve_Diffie-Hellman#Ephemeral_Key_as_.28x.2Cy.29 . It applies to ECIES as well. The pain point in using ephemeral keys is they are meant for one run of the protocol, so they don't lend themselves to manipulation outside of the scheme objects. The static or long term keys are a different story. An ephemeral key is meant to be used by, for example, SimpleKeyAgreementDomain, which culminates in a call to Agree(...). Since the SimpleKeyAgreementDomain does all the work, there's usually less support for importing and exporting the ephemeral key. It can be done, but you have to understand the details. Jeff -- -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [email protected]. More information about Crypto++ and this group is available at http://www.cryptopp.com. --- You received this message because you are subscribed to the Google Groups "Crypto++ Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
