22 #ifndef NDN_RSA_PUBLIC_KEY_LITE_HPP
23 #define NDN_RSA_PUBLIC_KEY_LITE_HPP
25 #include "../util/blob-lite.hpp"
26 #include "../../c/errors.h"
27 #include "../../c/encrypt/algo/encrypt-params-types.h"
28 #include "../../c/security/rsa-public-key-types.h"
57 decode(
const uint8_t* publicKeyDer,
size_t publicKeyDerLength);
84 encode(uint8_t* encoding,
size_t& encodingLength)
const;
96 (
const uint8_t* signature,
size_t signatureLength,
const uint8_t* data,
97 size_t dataLength)
const;
127 (
const uint8_t *signature,
size_t signatureLength,
const uint8_t *data,
128 size_t dataLength,
const uint8_t *publicKeyDer,
size_t publicKeyDerLength,
143 const BlobLite& publicKeyDer,
bool &verified)
147 publicKeyDer.
buf(), publicKeyDer.
size(), verified);
165 (
const uint8_t* plainData,
size_t plainDataLength,
166 ndn_EncryptAlgorithmType algorithmType, uint8_t* encryptedData,
167 size_t& encryptedDataLength)
const;
183 (
const BlobLite& plainData, ndn_EncryptAlgorithmType algorithmType,
184 uint8_t* encryptedData,
size_t& encryptedDataLength)
const
187 (plainData.
buf(), plainData.
size(), algorithmType, encryptedData,
188 encryptedDataLength);
static RsaPublicKeyLite & downCast(ndn_RsaPublicKey &blob)
Downcast the reference to the ndn_RsaPublicKey struct to a RsaPublicKeyLite.
Definition: rsa-public-key-lite.hpp:197
size_t size() const
Return size given to the constructor.
Definition: blob-lite.hpp:61
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:36
~RsaPublicKeyLite()
Finalize the RsaPublicKeyLite, freeing memory if needed.
Definition: rsa-public-key-lite.cpp:32
static ndn_Error verifySha256WithRsaSignature(const uint8_t *signature, size_t signatureLength, const uint8_t *data, size_t dataLength, const uint8_t *publicKeyDer, size_t publicKeyDerLength, bool &verified)
Verify the RSA signature of the data using the given public key.
Definition: rsa-public-key-lite.cpp:61
ndn_Error decode(const BlobLite &publicKeyDer)
Decode the publicKeyDer and set this RsaPublicKeyLite, allocating memory as needed.
Definition: rsa-public-key-lite.hpp:67
ndn_Error decode(const uint8_t *publicKeyDer, size_t publicKeyDerLength)
Decode the publicKeyDer and set this RsaPublicKeyLite, allocating memory as needed.
Definition: rsa-public-key-lite.cpp:39
An RsaPublicKeyLite holds a decoded RSA public key for use in crypto operations.
Definition: rsa-public-key-lite.hpp:36
bool verifyWithSha256(const uint8_t *signature, size_t signatureLength, const uint8_t *data, size_t dataLength) const
Use this public key to verify the data using RsaWithSha256.
Definition: rsa-public-key-lite.cpp:52
A struct ndn_RsaPublicKey holds a decoded RSA public key for use in crypto operations.
Definition: rsa-public-key-types.h:34
RsaPublicKeyLite()
Create an RsaPublicKeyLite with a null value.
Definition: rsa-public-key-lite.cpp:27
A BlobLite holds a pointer to an immutable pre-allocated buffer and its length This is like a JavaScr...
Definition: blob-lite.hpp:37
const uint8_t * buf() const
Return buf given to the constructor.
Definition: blob-lite.hpp:55
bool verifyWithSha256(const BlobLite &signature, const BlobLite &data) const
Use this public key to verify the data using RsaWithSha256.
Definition: rsa-public-key-lite.hpp:106
ndn_Error encrypt(const uint8_t *plainData, size_t plainDataLength, ndn_EncryptAlgorithmType algorithmType, uint8_t *encryptedData, size_t &encryptedDataLength) const
Use this public key to encrypt plainData according to the algorithmType.
Definition: rsa-public-key-lite.cpp:75
ndn_Error encode(uint8_t *encoding, size_t &encodingLength) const
Encode the DER-encoded SubjectPublicKeyInfo.
Definition: rsa-public-key-lite.cpp:45