Skip to content

Commit 00e46f5

Browse files
authored
Merge pull request #6 from jpbland1/pkcs7
Pkcs7
2 parents d57fc88 + 272e9f6 commit 00e46f5

File tree

10 files changed

+761
-1
lines changed

10 files changed

+761
-1
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,9 @@ PASS ecc signVerify
6161
PASS ecc importExportx963
6262
PASS ecc importExportDer
6363
PASS pbkdf2
64+
PASS pkcs7 addCertificate
65+
PASS pkcs7 encodeData
66+
PASS pkcs7 signVerify
67+
PASS pkcs7 getAttribute
68+
PASS pkcs7 getSid
6469
```

addon/wolfcrypt/h/pkcs7.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/* pkcs7.h
2+
*
3+
* Copyright (C) 2006-2022 wolfSSL Inc.
4+
*
5+
* This file is part of wolfSSL.
6+
*
7+
* wolfSSL is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 2 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* wolfSSL is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20+
*/
21+
#include <napi.h>
22+
#include <wolfssl/options.h>
23+
#include <wolfssl/wolfcrypt/settings.h>
24+
#include <wolfssl/wolfcrypt/error-crypt.h>
25+
#include <wolfssl/wolfcrypt/pkcs7.h>
26+
27+
Napi::Number sizeof_PKCS7(const Napi::CallbackInfo& info);
28+
Napi::Number typeof_Key_Sum(const Napi::CallbackInfo& info);
29+
Napi::Number typeof_Hash_Sum(const Napi::CallbackInfo& info);
30+
Napi::Number bind_wc_PKCS7_Init(const Napi::CallbackInfo& info);
31+
Napi::Number bind_wc_PKCS7_InitWithCert(const Napi::CallbackInfo& info);
32+
Napi::Number bind_wc_PKCS7_AddCertificate(const Napi::CallbackInfo& info);
33+
Napi::Number bind_wc_PKCS7_EncodeData(const Napi::CallbackInfo& info);
34+
Napi::Number bind_wc_PKCS7_EncodeSignedData(const Napi::CallbackInfo& info);
35+
Napi::Number bind_wc_PKCS7_VerifySignedData(const Napi::CallbackInfo& info);
36+
Napi::Number sizeof_wc_PKCS7_GetAttributeValue(const Napi::CallbackInfo& info);
37+
Napi::Number bind_wc_PKCS7_GetAttributeValue(const Napi::CallbackInfo& info);
38+
Napi::Number sizeof_wc_PKCS7_GetSignerSID(const Napi::CallbackInfo& info);
39+
Napi::Number bind_wc_PKCS7_GetSignerSID(const Napi::CallbackInfo& info);
40+
void bind_wc_PKCS7_Free(const Napi::CallbackInfo& info);

addon/wolfcrypt/main.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "./h/sha.h"
2828
#include "./h/ecc.h"
2929
#include "./h/pbkdf2.h"
30+
#include "./h/pkcs7.h"
3031

3132
using namespace Napi;
3233

@@ -122,6 +123,21 @@ Napi::Object Init(Napi::Env env, Napi::Object exports)
122123

123124
exports.Set(Napi::String::New(env, "wc_PBKDF2"), Napi::Function::New(env, bind_wc_PBKDF2));
124125

126+
exports.Set(Napi::String::New(env, "sizeof_PKCS7"), Napi::Function::New(env, sizeof_PKCS7));
127+
exports.Set(Napi::String::New(env, "typeof_Key_Sum"), Napi::Function::New(env, typeof_Key_Sum));
128+
exports.Set(Napi::String::New(env, "typeof_Hash_Sum"), Napi::Function::New(env, typeof_Hash_Sum));
129+
exports.Set(Napi::String::New(env, "wc_PKCS7_Init"), Napi::Function::New(env, bind_wc_PKCS7_Init));
130+
exports.Set(Napi::String::New(env, "wc_PKCS7_InitWithCert"), Napi::Function::New(env, bind_wc_PKCS7_InitWithCert));
131+
exports.Set(Napi::String::New(env, "wc_PKCS7_AddCertificate"), Napi::Function::New(env, bind_wc_PKCS7_AddCertificate));
132+
exports.Set(Napi::String::New(env, "wc_PKCS7_EncodeData"), Napi::Function::New(env, bind_wc_PKCS7_EncodeData));
133+
exports.Set(Napi::String::New(env, "wc_PKCS7_EncodeSignedData"), Napi::Function::New(env, bind_wc_PKCS7_EncodeSignedData));
134+
exports.Set(Napi::String::New(env, "wc_PKCS7_VerifySignedData"), Napi::Function::New(env, bind_wc_PKCS7_VerifySignedData));
135+
exports.Set(Napi::String::New(env, "sizeof_wc_PKCS7_GetAttributeValue"), Napi::Function::New(env, sizeof_wc_PKCS7_GetAttributeValue));
136+
exports.Set(Napi::String::New(env, "wc_PKCS7_GetAttributeValue"), Napi::Function::New(env, bind_wc_PKCS7_GetAttributeValue));
137+
exports.Set(Napi::String::New(env, "sizeof_wc_PKCS7_GetSignerSID"), Napi::Function::New(env, sizeof_wc_PKCS7_GetSignerSID));
138+
exports.Set(Napi::String::New(env, "wc_PKCS7_GetSignerSID"), Napi::Function::New(env, bind_wc_PKCS7_GetSignerSID));
139+
exports.Set(Napi::String::New(env, "wc_PKCS7_Free"), Napi::Function::New(env, bind_wc_PKCS7_Free));
140+
125141
return exports;
126142
}
127143

0 commit comments

Comments
 (0)