rsa-private-key.h
1 
21 #ifndef NDN_RSA_PRIVATE_KEY_H
22 #define NDN_RSA_PRIVATE_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-private-key-types.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
37 static __inline void
38 ndn_RsaPrivateKey_initialize(struct ndn_RsaPrivateKey *self)
39 {
40  self->privateKey = 0;
41 }
42 
47 void
48 ndn_RsaPrivateKey_finalize(struct ndn_RsaPrivateKey *self);
49 
60 ndn_Error
61 ndn_RsaPrivateKey_decode
62  (struct ndn_RsaPrivateKey *self, const uint8_t *privateKeyDer,
63  size_t privateKeyDerLength);
64 
73 ndn_Error
74 ndn_RsaPrivateKey_generate(struct ndn_RsaPrivateKey *self, uint32_t keySize);
75 
88 ndn_Error
89 ndn_RsaPrivateKey_encodePrivateKey
90  (const struct ndn_RsaPrivateKey *self, uint8_t *encoding,
91  size_t *encodingLength);
92 
105 ndn_Error
106 ndn_RsaPrivateKey_encodePublicKey
107  (const struct ndn_RsaPrivateKey *self, uint8_t *encoding,
108  size_t *encodingLength);
109 
122 ndn_Error
123 ndn_RsaPrivateKey_signWithSha256
124  (const struct ndn_RsaPrivateKey *self, const uint8_t *data, size_t dataLength,
125  uint8_t *signature, size_t *signatureLength);
126 
141 ndn_Error
142 ndn_RsaPrivateKey_decrypt
143  (const struct ndn_RsaPrivateKey *self, const uint8_t *encryptedData,
144  size_t encryptedDataLength, ndn_EncryptAlgorithmType algorithmType,
145  uint8_t *plainData, size_t *plainDataLength);
146 
147 #ifdef __cplusplus
148 }
149 #endif
150 
151 #endif
A struct ndn_RsaPrivateKey holds a decoded RSA private key for use in crypto operations.
Definition: rsa-private-key-types.h:34