CryptoLite has static methods for basic cryptography operations.
More...
#include <crypto-lite.hpp>
|
| static void | digestSha256 (const uint8_t *data, size_t dataLength, uint8_t *digest) |
| | Compute the sha-256 digest of data. More...
|
| |
| static void | digestSha256 (const BlobLite &data, uint8_t *digest) |
| | Compute the sha-256 digest of data. More...
|
| |
| static ndn_Error | generateRandomBytes (uint8_t *buffer, size_t bufferLength) |
| | Fill the buffer with random bytes. More...
|
| |
| static void | computeHmacWithSha256 (const uint8_t *key, size_t keyLength, const uint8_t *data, size_t dataLength, uint8_t *digest) |
| | Compute the HMAC with sha-256 of data, as defined in http://tools.ietf.org/html/rfc2104#section-2 . More...
|
| |
| static void | computeHmacWithSha256 (const BlobLite &key, const BlobLite &data, uint8_t *digest) |
| | Compute the HMAC with sha-256 of data, as defined in http://tools.ietf.org/html/rfc2104#section-2 . More...
|
| |
| static bool | verifyHmacWithSha256Signature (const uint8_t *key, size_t keyLength, const uint8_t *signature, size_t signatureLength, const uint8_t *data, size_t dataLength) |
| | Verify that the HMAC with sha-256 of the data equals the signature, as defined in http://tools.ietf.org/html/rfc2104#section-2 . More...
|
| |
| static bool | verifyHmacWithSha256Signature (const BlobLite &key, const BlobLite &signature, const BlobLite &data) |
| | Verify that the HMAC with sha-256 of the data equals the signature, as defined in http://tools.ietf.org/html/rfc2104#section-2 . More...
|
| |
| static bool | verifyDigestSha256Signature (const uint8_t *signature, size_t signatureLength, const uint8_t *data, size_t dataLength) |
| | Verify that the DigestSha256 of the data equals the signature. More...
|
| |
| static bool | verifyDigestSha256Signature (const BlobLite &signature, const BlobLite &data) |
| | Verify that the DigestSha256 of the data equals the signature. More...
|
| |
CryptoLite has static methods for basic cryptography operations.
| static void ndn::CryptoLite::computeHmacWithSha256 |
( |
const uint8_t * |
key, |
|
|
size_t |
keyLength, |
|
|
const uint8_t * |
data, |
|
|
size_t |
dataLength, |
|
|
uint8_t * |
digest |
|
) |
| |
|
static |
Compute the HMAC with sha-256 of data, as defined in http://tools.ietf.org/html/rfc2104#section-2 .
- Parameters
-
| key | A pointer to buffer with the key. |
| keyLength | The length of key. |
| data | A pointer to the input byte array. |
| dataLength | The length of data. |
| digest | A pointer to a buffer of size ndn_SHA256_DIGEST_SIZE to receive the HMAC digest. |
| static void ndn::CryptoLite::computeHmacWithSha256 |
( |
const BlobLite & |
key, |
|
|
const BlobLite & |
data, |
|
|
uint8_t * |
digest |
|
) |
| |
|
inlinestatic |
Compute the HMAC with sha-256 of data, as defined in http://tools.ietf.org/html/rfc2104#section-2 .
- Parameters
-
| key | The key. |
| data | The input byte array. |
| digest | A pointer to a buffer of size ndn_SHA256_DIGEST_SIZE to receive the HMAC digest. |
| void ndn::CryptoLite::digestSha256 |
( |
const uint8_t * |
data, |
|
|
size_t |
dataLength, |
|
|
uint8_t * |
digest |
|
) |
| |
|
static |
Compute the sha-256 digest of data.
- Parameters
-
| data | Pointer to the input byte array. |
| dataLength | The length of data. |
| digest | A pointer to a buffer of size ndn_SHA256_DIGEST_SIZE to receive the digest. |
| static void ndn::CryptoLite::digestSha256 |
( |
const BlobLite & |
data, |
|
|
uint8_t * |
digest |
|
) |
| |
|
inlinestatic |
Compute the sha-256 digest of data.
- Parameters
-
| data | The input byte array. |
| digest | A pointer to a buffer of size ndn_SHA256_DIGEST_SIZE to receive the digest. |
| ndn_Error ndn::CryptoLite::generateRandomBytes |
( |
uint8_t * |
buffer, |
|
|
size_t |
bufferLength |
|
) |
| |
|
static |
Fill the buffer with random bytes.
- Parameters
-
| buffer | Write the random bytes to this buffer. |
| bufferLength | The number of bytes to write to buffer. |
- Returns
- 0 for success, else NDN_ERROR_Error_in_generate_operation for an error including if the random number generator is not seeded.
| bool ndn::CryptoLite::verifyDigestSha256Signature |
( |
const uint8_t * |
signature, |
|
|
size_t |
signatureLength, |
|
|
const uint8_t * |
data, |
|
|
size_t |
dataLength |
|
) |
| |
|
static |
Verify that the DigestSha256 of the data equals the signature.
- Parameters
-
| signature | A pointer to the signature bytes. |
| signatureLength | The length of signature. |
| data | A pointer to the input byte array to verify. |
| dataLength | The length of data. |
- Returns
- True if the signature verifies, false if not.
| static bool ndn::CryptoLite::verifyDigestSha256Signature |
( |
const BlobLite & |
signature, |
|
|
const BlobLite & |
data |
|
) |
| |
|
inlinestatic |
Verify that the DigestSha256 of the data equals the signature.
- Parameters
-
| signature | The signature bytes. |
| data | The byte array to verify. |
- Returns
- True if the signature verifies, false if not.
| static bool ndn::CryptoLite::verifyHmacWithSha256Signature |
( |
const uint8_t * |
key, |
|
|
size_t |
keyLength, |
|
|
const uint8_t * |
signature, |
|
|
size_t |
signatureLength, |
|
|
const uint8_t * |
data, |
|
|
size_t |
dataLength |
|
) |
| |
|
static |
Verify that the HMAC with sha-256 of the data equals the signature, as defined in http://tools.ietf.org/html/rfc2104#section-2 .
(This is a separate method from computeHmacWithSha256 so that we can use a crypto-safe comparison function.)
- Parameters
-
| key | A pointer to buffer with the key. |
| keyLength | The length of key. |
| signature | A pointer to the signature bytes. |
| signatureLength | The length of signature. |
| data | A pointer to the input byte array to verify. |
| dataLength | The length of data. |
- Returns
- True if the signature verifies, false if not.
| static bool ndn::CryptoLite::verifyHmacWithSha256Signature |
( |
const BlobLite & |
key, |
|
|
const BlobLite & |
signature, |
|
|
const BlobLite & |
data |
|
) |
| |
|
inlinestatic |
Verify that the HMAC with sha-256 of the data equals the signature, as defined in http://tools.ietf.org/html/rfc2104#section-2 .
(This is a separate method from computeHmacWithSha256 so that we can use a crypto-safe comparison function.)
- Parameters
-
| key | The key. |
| signature | The signature bytes. |
| data | The byte array to verify. |
- Returns
- True if the signature verifies, false if not.
The documentation for this class was generated from the following files: