You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We wanted to be able to write Javascript that used crypto on both the client and the server but we did not want to rely on Javascript implementations of crypto. The only native cryptography availible in browser is [Web Crypto](caniuse.com/#search=cryptography), this resulted in us creating a [native polyfil for WebCrypto based on Openssl](https://github.com/PeculiarVentures/node-webcrypto-ossl).
11
11
12
-
Our project also required us to utilize Hardware Security Modules and smart cards on the server side so we made a [library called Graphene that made it possible to use PKCS#11 devices from within Nodejs](https://github.com/PeculiarVentures/graphene).
12
+
Our project also required us to utilize Hardware Security Modules and smart cards on the server side so we made a [library called Graphene that made it possible to use PKCS#11 devices from within Nodejs](https://github.com/PeculiarVentures/graphene).
13
13
14
14
We then thought that in most cases others did not care about interacting with the token directly and would prefer a higher level API they were already familiar with. We hope that library is `node-webcrypto-p11`, if you have code based on WebCrypto (for example the excelent [js-jose](https://github.com/square/js-jose)) with only a change in a constructor you can work with PKCS#11 devices.
15
15
@@ -18,23 +18,25 @@ For example to generate a key you this is all it takes:
| RSAES-PKCS1-v1_5 <sub>2</sub> | X || X || X | X ||
60
+
| RSA-PSS | X || X | X ||||
61
+
| RSA-OAEP | X || X || X | X ||
62
+
| AES-CBC | X || X || X | X ||
63
+
| AES-ECB <sub>2</sub> | X || X || X | X ||
64
+
| AES-GCM | X || X || X | X ||
65
+
| ECDSA <sub>1</sub> | X || X | X ||||
66
+
| ECDH <sub>2</sub> | X || X |||| X |
67
+
| HMAC | X || X | X ||||
65
68
66
69
<sup>1</sup> Mechanism supports extended list of named curves `P-256`, `P-384`, `P-521`, and `K-256`
67
70
@@ -87,10 +90,9 @@ cd node-webcrypto-p11
87
90
- For OSX see the [instructions here](https://github.com/opendnssec/SoftHSMv2/blob/develop/OSX-NOTES.md)
88
91
- For linux [instructions here](https://github.com/opendnssec/SoftHSMv2/blob/develop/README.md)
89
92
90
-
91
-
### Install
93
+
### Install
92
94
93
-
```
95
+
```
94
96
npm install
95
97
```
96
98
@@ -116,30 +118,38 @@ module.exports = {
116
118
```
117
119
118
120
## Threats
121
+
119
122
The threat model is defined in terms of what each possible attacker can achieve. The list is intended to be exhaustive.
120
123
121
124
### Assumptions
125
+
122
126
TODO: ADD ASSUMPTIONS
123
127
124
128
### Threats From A node-webcrypto-p11 Defect
129
+
125
130
`node-webcrypto-p11` handles ciphertext, cleartext, and sessions. A defect in this library could result in these values being exposed to an attacker. Examples of such defects include:
131
+
126
132
- Buffer, Integer or other overflow related defects,
127
133
- Parsing errors,
128
134
- Logic errors,
129
135
- Weak user seperation or permissions.
130
136
131
137
### Threats From A PKCS#11 defect
138
+
132
139
PKCS#11 implementations are often old, poorly maintained and incomplete. This can obviously lead to defects. Defects in the PKCS#11 implementation can result in:
140
+
133
141
- Weakly implemented or applied cryptographic primitives,
134
142
- Leaked sessions or secrets that expose use of the key,
135
143
- Leaked cryptographic key material.
136
144
137
145
### Threats From Weak Cryptography
146
+
138
147
Secure use of cryptography requires the implementor to understand the security properties of a given algorithm as well as how to use it in a secure construction.
139
148
140
149
Additionally this library exposes some algorithms that may have known weakneses or are simply too old to be used safely.
141
150
142
151
### Threats From Improper Use Of Cryptography
152
+
143
153
It is easy to apply cryptography but hard to apply it correctly. Algorithms each have their own security properties and appropriate constructions. The consumer of this library is responsible for understanding how to use the exposed algorithms securely.
144
154
145
155
### Generates `ECDSA` key pair with named curve `P-256` and signs/verifies text message.
@@ -148,29 +158,47 @@ It is easy to apply cryptography but hard to apply it correctly. Algorithms each
The [CryptoKeyStorage](https://github.com/PeculiarVentures/webcrypto-docs/blob/master/KEY_STORAGE.md#cryptokeystorage) interface enables you to persist and retrieve keys across sessions.
The [CryptoCertificateStorage](https://github.com/PeculiarVentures/webcrypto-docs/blob/master/CERT_STORAGE.md#cryptocertstorage) interface enables you to persist and retrieve certificates across sessions.
190
223
191
224
### Add certificate to storage and use it for verification of signed data
Please report bugs either as pull requests or as issues in the issue tracker. Backwater has a full disclosure vulnerability policy. Please do NOT attempt to report any security vulnerability in this code privately to anybody.
0 commit comments