DEREncode
Jump to navigation
Jump to search
Documentation |
#include <cryptopp/cryptlib.h>
|
DEREncode encodes an object using ASN.1 DER encoding. Calling Save
on a class object usually calls DEREncode
. If it is too inefficient to encode an object using DER, then consider using BEREncode
instead. The companion to DEREncode
is BERDecode
.
Each class object has their own format for encoding. The documentation for the class usually specifies the standard used to encode an object.
Also see Keys and Formats wiki page.
Sample
using namespace CryptoPP; // Grab a Generator AutoSeededRandomPool prng; // Specify modulus, accept e = 17. 128-bits is artificially small. RSAES_OAEP_SHA_Decryptor Decryptor( prng, 128 /*, e */ ); RSAES_OAEP_SHA_Encryptor Encryptor( Decryptor ); // BER Encoded Keys std::string pbkey, pvkey; // Hex Encoder HexEncoder encoder; // Public Key encoder.Attach( new StringSink( pbkey ) ); Encryptor.GetPublicKey().Save( encoder ); // Private Key encoder.Attach( new StringSink( pvkey ) ); Encryptor.GetPrivateKey().Save( encoder );
Downloads
No downloads.