rsa-public-key.h
1 
21 #ifndef NDN_RSA_PUBLIC_KEY_H
22 #define NDN_RSA_PUBLIC_KEY_H
23 
24 #include <ndn-cpp/c/common.h>
25 #include <ndn-cpp/c/errors.h>
26 #include <ndn-cpp/c/encrypt/algo/encrypt-params-types.h>
27 #include <ndn-cpp/c/security/rsa-public-key-types.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
37 static __inline void
38 ndn_RsaPublicKey_initialize(struct ndn_RsaPublicKey *self)
39 {
40  self->publicKey = 0;
41 }
42 
47 void
48 ndn_RsaPublicKey_finalize(struct ndn_RsaPublicKey *self);
49 
59 ndn_Error
60 ndn_RsaPublicKey_decode
61  (struct ndn_RsaPublicKey *self, const uint8_t *publicKeyDer,
62  size_t publicKeyDerLength);
63 
76 ndn_Error
77 ndn_RsaPublicKey_encode
78  (const struct ndn_RsaPublicKey *self, uint8_t *encoding,
79  size_t *encodingLength);
80 
90 int
91 ndn_RsaPublicKey_verifyWithSha256
92  (const struct ndn_RsaPublicKey *self, const uint8_t *signature,
93  size_t signatureLength, const uint8_t *data, size_t dataLength);
94 
108 ndn_Error
109 ndn_verifySha256WithRsaSignature
110  (const uint8_t *signature, size_t signatureLength, const uint8_t *data,
111  size_t dataLength, const uint8_t *publicKeyDer, size_t publicKeyDerLength,
112  int *verified);
113 
128 ndn_Error
129 ndn_RsaPublicKey_encrypt
130  (const struct ndn_RsaPublicKey *self, const uint8_t *plainData,
131  size_t plainDataLength, ndn_EncryptAlgorithmType algorithmType,
132  uint8_t *encryptedData, size_t *encryptedDataLength);
133 
134 #ifdef __cplusplus
135 }
136 #endif
137 
138 #endif
A struct ndn_RsaPublicKey holds a decoded RSA public key for use in crypto operations.
Definition: rsa-public-key-types.h:34