DecodingResult
Jump to navigation
Jump to search
Documentation |
#include <cryptopp/cryptlib.h>
|
DecodingResult is used to hold the result of a decryption operation.
If you are using Filters then see SignerFilter
and SignatureVerificationFilter
.
Contsructor
Sample
// Decryption DecodingResult result = decryptor.Decrypt( ... ); // Crypto++ Test if( false == result.isValidCoding ) { throw std::runtime_error("Crypto++: decryption failed"); }
#define ECC_ALGORITHM ECP #define ECC_CURVE ASN1::secp160r1() ECIES< ECC_ALGORITHM >::PrivateKey PrivateKey; ECIES< ECC_ALGORITHM >::PublicKey PublicKey; AutoSeededRandomPool rng; // Curve Key Generation privateKey.Initialize( rng, ECC_CURVE ); privateKey.MakePublicKey( PublicKey ); // Encryptor and Decryptor ECIES< ECC_ALGORITHM >::Encryptor encryptor( publicKey ); ECIES< ECC_ALGORITHM >::Decryptor decryptor( privateKey ); // Message std::string plainText = "Yoda said, Do or do not. There is no try."; ... // Encryption encryptor.Encrypt( rng, reinterpret_cast<const byte*>(plainText.c_str()), plainTextLength, cipherText); ... // Decryption DecodingResult result = decryptor.Decrypt( rng, cipherText, cipherTextLength, reinterpret_cast<byte*>(recoveredText)); // Crypto++ Test if( false == result.isValidCoding ) { throw std::runtime_error("Crypto++: decryption failed"); }