I am trying to DER encode the public component according to the RFC 3279 
spec, but got stuck midway trough.
My code so far is like this:
void EncodePublicKeyMinimized(const string& filename, const ECDSA<ECP, 
SHA256>::PublicKey& key)
{
    ByteQueue queue;
    
    DERSequenceEncoder(DERSequenceEncoder(queue, 
ASNTag::SEQUENCE|ASNIdFlag::CONSTRUCTED), 
ASNTag::SEQUENCE|ASNIdFlag::CONSTRUCTED);
 
    publicKey.GetAlgorithmID().DEREncode(queue);
    (CryptoPP::ASN1::secp256r1()).DEREncode(queue);
 
    publicKey.GetGroupParameters().GetCurve().EncodePoint(queue, 
publicKey.GetPublicElement(), false);
    EncodeMinimized(filename, queue);
}
 
I'm trying to get the two Object Identifiers nested in the second Sequence 
and to nest the Public Element as the last thing in the outer Sequence. I 
can get the first OID nested correctly but then it stops.

-- 
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.

Reply via email to