All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Static Public Member Functions | List of all members
ndn::VerificationHelpers Class Reference

The VerificationHelpers class has static methods to verify signatures and digests. More...

#include <verification-helpers.hpp>

Static Public Member Functions

static bool verifySignature (const uint8_t *buffer, size_t bufferLength, const uint8_t *signature, size_t signatureLength, const PublicKey &publicKey, DigestAlgorithm digestAlgorithm=DIGEST_ALGORITHM_SHA256)
 Verify the buffer against the signature using the public key. More...
 
static bool verifySignature (const Blob &buffer, const Blob &signature, const PublicKey &publicKey, DigestAlgorithm digestAlgorithm=DIGEST_ALGORITHM_SHA256)
 Verify the buffer against the signature using the public key. More...
 
static bool verifySignature (const uint8_t *buffer, size_t bufferLength, const uint8_t *signature, size_t signatureLength, const Blob &publicKeyDer, DigestAlgorithm digestAlgorithm=DIGEST_ALGORITHM_SHA256)
 Verify the buffer against the signature using the encoded public key. More...
 
static bool verifySignature (const Blob &buffer, const Blob &signature, const Blob &publicKeyDer, DigestAlgorithm digestAlgorithm=DIGEST_ALGORITHM_SHA256)
 Verify the buffer against the signature using the encoded public key. More...
 
static bool verifyDataSignature (const Data &data, const PublicKey &publicKey, DigestAlgorithm digestAlgorithm=DIGEST_ALGORITHM_SHA256, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Verify the Data packet using the public key. More...
 
static bool verifyDataSignature (const Data &data, const Blob &publicKeyDer, DigestAlgorithm digestAlgorithm=DIGEST_ALGORITHM_SHA256, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Verify the Data packet using the public key. More...
 
static bool verifyDataSignature (const Data &data, const CertificateV2 &certificate, DigestAlgorithm digestAlgorithm=DIGEST_ALGORITHM_SHA256, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Verify the Data packet using the public key in the certificate. More...
 
static bool verifyInterestSignature (const Interest &interest, const PublicKey &publicKey, DigestAlgorithm digestAlgorithm=DIGEST_ALGORITHM_SHA256, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Verify the Interest packet using the public key, where the last two name components are the SignatureInfo and signature bytes. More...
 
static bool verifyInterestSignature (const Interest &interest, const Blob &publicKeyDer, DigestAlgorithm digestAlgorithm=DIGEST_ALGORITHM_SHA256, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Verify the Interest packet using the public key, where the last two name components are the SignatureInfo and signature bytes. More...
 
static bool verifyInterestSignature (const Interest &interest, const CertificateV2 &certificate, DigestAlgorithm digestAlgorithm=DIGEST_ALGORITHM_SHA256, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Verify the Interest packet using the public key in the certificate, where the last two name components are the SignatureInfo and signature bytes. More...
 
static bool verifyDigest (const uint8_t *buffer, size_t bufferLength, const uint8_t *digest, size_t digestLength, DigestAlgorithm digestAlgorithm)
 Verify the buffer against the digest using the digest algorithm. More...
 
static bool verifyDigest (const Blob &buffer, const Blob &digest, DigestAlgorithm digestAlgorithm)
 Verify the buffer against the digest using the digest algorithm. More...
 
static bool verifyDataDigest (const Data &data, DigestAlgorithm digestAlgorithm, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Verify the Data packet using the digest algorithm. More...
 
static bool verifyInterestDigest (const Interest &interest, DigestAlgorithm digestAlgorithm, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Verify the Interest packet using the digest algorithm, where the last two name components are the SignatureInfo and signature bytes. More...
 

Detailed Description

The VerificationHelpers class has static methods to verify signatures and digests.

Member Function Documentation

bool ndn::VerificationHelpers::verifyDataDigest ( const Data data,
DigestAlgorithm  digestAlgorithm,
WireFormat wireFormat = *WireFormat::getDefaultWireFormat() 
)
static

Verify the Data packet using the digest algorithm.

This does not check the digest algorithm against the type of SignatureInfo in the Data packet such as DigestSha256Signature.

Parameters
dataThe Data packet to verify.
digestAlgorithmThe digest algorithm, such as DIGEST_ALGORITHM_SHA256.
wireFormat(optional) A WireFormat object used to encode the Data packet. If omitted, use WireFormat getDefaultWireFormat().
Returns
True if verification succeeds, false if verification fails.
Exceptions
invalid_argumentfor an invalid digestAlgorithm.
bool ndn::VerificationHelpers::verifyDataSignature ( const Data data,
const PublicKey publicKey,
DigestAlgorithm  digestAlgorithm = DIGEST_ALGORITHM_SHA256,
WireFormat wireFormat = *WireFormat::getDefaultWireFormat() 
)
static

Verify the Data packet using the public key.

This does not check the type of public key or digest algorithm against the type of SignatureInfo in the Data packet such as Sha256WithRsaSignature.

Parameters
dataThe Data packet to verify.
publicKeyThe object containing the public key.
digestAlgorithm(optional) The digest algorithm. If omitted, use SHA256.
wireFormat(optional) A WireFormat object used to encode the Data packet. If omitted, use WireFormat getDefaultWireFormat().
Returns
True if verification succeeds, false if verification fails.
Exceptions
invalid_argumentfor an invalid public key type or digestAlgorithm.
bool ndn::VerificationHelpers::verifyDataSignature ( const Data data,
const Blob publicKeyDer,
DigestAlgorithm  digestAlgorithm = DIGEST_ALGORITHM_SHA256,
WireFormat wireFormat = *WireFormat::getDefaultWireFormat() 
)
static

Verify the Data packet using the public key.

This does not check the type of public key or digest algorithm against the type of SignatureInfo in the Data packet such as Sha256WithRsaSignature. If the public key can't be decoded, this returns false instead of throwing a decoding exception. If you want to get a decoding exception then use the PublicKey constructor to decode and call verifyDataSignature with the PublicKey object.

Parameters
dataThe Data packet to verify.
publicKeyDerThe DER-encoded public key.
digestAlgorithm(optional) The digest algorithm. If omitted, use SHA256.
wireFormat(optional) A WireFormat object used to encode the Data packet. If omitted, use WireFormat getDefaultWireFormat().
Returns
True if verification succeeds, false if verification fails or for an error decoding the public key.
Exceptions
invalid_argumentfor an invalid public key type or digestAlgorithm.
static bool ndn::VerificationHelpers::verifyDataSignature ( const Data data,
const CertificateV2 certificate,
DigestAlgorithm  digestAlgorithm = DIGEST_ALGORITHM_SHA256,
WireFormat wireFormat = *WireFormat::getDefaultWireFormat() 
)
inlinestatic

Verify the Data packet using the public key in the certificate.

This does not check the type of public key or digest algorithm against the type of SignatureInfo in the Data packet such as Sha256WithRsaSignature.

Parameters
dataThe Data packet to verify.
certificateThe certificate containing the public key.
digestAlgorithm(optional) The digest algorithm. If omitted, use SHA256.
wireFormat(optional) A WireFormat object used to encode the Data packet. If omitted, use WireFormat getDefaultWireFormat().
Returns
True if verification succeeds, false if verification fails or for an error decoding the public key.
Exceptions
invalid_argumentfor an invalid public key type or digestAlgorithm.
bool ndn::VerificationHelpers::verifyDigest ( const uint8_t *  buffer,
size_t  bufferLength,
const uint8_t *  digest,
size_t  digestLength,
DigestAlgorithm  digestAlgorithm 
)
static

Verify the buffer against the digest using the digest algorithm.

Parameters
bufferA pointer to the input buffer to verify.
bufferLengthThe length of the buffer.
digestA pointer to the digest bytes.
digestLengthThe length of the digest.
digestAlgorithmThe digest algorithm, such as DIGEST_ALGORITHM_SHA256.
Returns
True if verification succeeds, false if verification fails.
Exceptions
invalid_argumentfor an invalid digestAlgorithm.
static bool ndn::VerificationHelpers::verifyDigest ( const Blob buffer,
const Blob digest,
DigestAlgorithm  digestAlgorithm 
)
inlinestatic

Verify the buffer against the digest using the digest algorithm.

Parameters
bufferThe input buffer to verify.
digestThe digest bytes.
digestAlgorithmThe digest algorithm, such as DIGEST_ALGORITHM_SHA256.
Returns
True if verification succeeds, false if verification fails.
Exceptions
invalid_argumentfor an invalid digestAlgorithm.
bool ndn::VerificationHelpers::verifyInterestDigest ( const Interest interest,
DigestAlgorithm  digestAlgorithm,
WireFormat wireFormat = *WireFormat::getDefaultWireFormat() 
)
static

Verify the Interest packet using the digest algorithm, where the last two name components are the SignatureInfo and signature bytes.

This does not check the digest algorithm against the type of SignatureInfo such as DigestSha256Signature.

Parameters
interestThe Interest packet to verify.
digestAlgorithmThe digest algorithm, such as DIGEST_ALGORITHM_SHA256.
wireFormat(optional) A WireFormat object used to decode the Interest packet. If omitted, use WireFormat getDefaultWireFormat().
Returns
True if verification succeeds, false if verification fails or cannot decode the Interest.
Exceptions
invalid_argumentfor an invalid digestAlgorithm.
bool ndn::VerificationHelpers::verifyInterestSignature ( const Interest interest,
const PublicKey publicKey,
DigestAlgorithm  digestAlgorithm = DIGEST_ALGORITHM_SHA256,
WireFormat wireFormat = *WireFormat::getDefaultWireFormat() 
)
static

Verify the Interest packet using the public key, where the last two name components are the SignatureInfo and signature bytes.

This does not check the type of public key or digest algorithm against the type of SignatureInfo such as Sha256WithRsaSignature.

Parameters
interestThe Interest packet to verify.
publicKeyThe object containing the public key.
digestAlgorithm(optional) The digest algorithm. If omitted, use SHA256.
wireFormat(optional) A WireFormat object used to decode the Interest packet. If omitted, use WireFormat getDefaultWireFormat().
Returns
True if verification succeeds, false if verification fails or cannot decode the Interest.
Exceptions
invalid_argumentfor an invalid public key type or digestAlgorithm.
bool ndn::VerificationHelpers::verifyInterestSignature ( const Interest interest,
const Blob publicKeyDer,
DigestAlgorithm  digestAlgorithm = DIGEST_ALGORITHM_SHA256,
WireFormat wireFormat = *WireFormat::getDefaultWireFormat() 
)
static

Verify the Interest packet using the public key, where the last two name components are the SignatureInfo and signature bytes.

This does not check the type of public key or digest algorithm against the type of SignatureInfo such as Sha256WithRsaSignature. If the public key can't be decoded, this returns false instead of throwing a decoding exception. If you want to get a decoding exception then use the PublicKey constructor to decode and call verifyInterestSignature with the PublicKey object.

Parameters
interestThe Interest packet to verify.
publicKeyDerThe DER-encoded public key.
digestAlgorithm(optional) The digest algorithm. If omitted, use SHA256.
wireFormat(optional) A WireFormat object used to decode the Interest packet. If omitted, use WireFormat getDefaultWireFormat().
Returns
True if verification succeeds, false if verification fails or cannot decode the Interest or public key.
Exceptions
invalid_argumentfor an invalid public key type or digestAlgorithm.
static bool ndn::VerificationHelpers::verifyInterestSignature ( const Interest interest,
const CertificateV2 certificate,
DigestAlgorithm  digestAlgorithm = DIGEST_ALGORITHM_SHA256,
WireFormat wireFormat = *WireFormat::getDefaultWireFormat() 
)
inlinestatic

Verify the Interest packet using the public key in the certificate, where the last two name components are the SignatureInfo and signature bytes.

This does not check the type of public key or digest algorithm against the type of SignatureInfo such as Sha256WithRsaSignature.

Parameters
interestThe Interest packet to verify.
certificateThe certificate containing the public key.
digestAlgorithm(optional) The digest algorithm. If omitted, use SHA256.
wireFormat(optional) A WireFormat object used to decode the Interest packet. If omitted, use WireFormat getDefaultWireFormat().
Returns
True if verification succeeds, false if verification fails or cannot decode the Interest or public key.
Exceptions
invalid_argumentfor an invalid public key type or digestAlgorithm.
bool ndn::VerificationHelpers::verifySignature ( const uint8_t *  buffer,
size_t  bufferLength,
const uint8_t *  signature,
size_t  signatureLength,
const PublicKey publicKey,
DigestAlgorithm  digestAlgorithm = DIGEST_ALGORITHM_SHA256 
)
static

Verify the buffer against the signature using the public key.

Parameters
bufferA pointer to the input buffer to verify.
bufferLengthThe length of the buffer.
signatureA pointer to the signature bytes.
signatureLengthThe length of the signature.
publicKeyThe object containing the public key.
digestAlgorithm(optional) The digest algorithm. If omitted, use SHA256.
Returns
True if verification succeeds, false if verification fails.
Exceptions
invalid_argumentfor an invalid public key type or digestAlgorithm.
static bool ndn::VerificationHelpers::verifySignature ( const Blob buffer,
const Blob signature,
const PublicKey publicKey,
DigestAlgorithm  digestAlgorithm = DIGEST_ALGORITHM_SHA256 
)
inlinestatic

Verify the buffer against the signature using the public key.

Parameters
bufferThe input buffer to verify.
signatureThe signature bytes.
publicKeyThe object containing the public key.
digestAlgorithm(optional) The digest algorithm. If omitted, use SHA256.
Returns
True if verification succeeds, false if verification fails.
Exceptions
invalid_argumentfor an invalid public key type or digestAlgorithm.
bool ndn::VerificationHelpers::verifySignature ( const uint8_t *  buffer,
size_t  bufferLength,
const uint8_t *  signature,
size_t  signatureLength,
const Blob publicKeyDer,
DigestAlgorithm  digestAlgorithm = DIGEST_ALGORITHM_SHA256 
)
static

Verify the buffer against the signature using the encoded public key.

If the public key can't be decoded, this returns false instead of throwing a decoding exception. If you want to get a decoding exception then use the PublicKey constructor to decode and call verifySignature with the PublicKey object.

Parameters
bufferA pointer to the input buffer to verify.
bufferLengthThe length of the buffer.
signatureA pointer to the signature bytes.
signatureLengthThe length of the signature.
publicKeyDerThe DER-encoded public key.
digestAlgorithm(optional) The digest algorithm. If omitted, use SHA256.
Returns
True if verification succeeds, false if verification fails or for an error decoding the public key.
Exceptions
invalid_argumentfor an invalid keyType or digestAlgorithm.
static bool ndn::VerificationHelpers::verifySignature ( const Blob buffer,
const Blob signature,
const Blob publicKeyDer,
DigestAlgorithm  digestAlgorithm = DIGEST_ALGORITHM_SHA256 
)
inlinestatic

Verify the buffer against the signature using the encoded public key.

If the public key can't be decoded, this returns false instead of throwing a decoding exception. If you want to get a decoding exception then use the PublicKey constructor to decode and call verifySignature with the PublicKey object.

Parameters
bufferThe input buffer to verify.
signatureThe signature bytes.
publicKeyDerThe DER-encoded public key.
digestAlgorithm(optional) The digest algorithm. If omitted, use SHA256.
Returns
True if verification succeeds, false if verification fails or for an error decoding the public key.
Exceptions
invalid_argumentfor an invalid keyType or digestAlgorithm.

The documentation for this class was generated from the following files: