@microsoft/ccf-app 3.0.0-dev4 → 3.0.0-dev5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/crypto.d.ts +4 -0
- package/crypto.js +4 -0
- package/global.d.ts +6 -0
- package/package.json +2 -2
- package/polyfill.js +17 -0
package/crypto.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ export declare const generateAesKey: (size: number) => ArrayBuffer;
|
|
|
6
6
|
* @inheritDoc CCF.generateRsaKeyPair
|
|
7
7
|
*/
|
|
8
8
|
export declare const generateRsaKeyPair: (size: number, exponent?: number | undefined) => import("./global.js").CryptoKeyPair;
|
|
9
|
+
/**
|
|
10
|
+
* @inheritDoc CCF.generateEcdsaKeyPair
|
|
11
|
+
*/
|
|
12
|
+
export declare const generateEcdsaKeyPair: (curve: string) => import("./global.js").CryptoKeyPair;
|
|
9
13
|
/**
|
|
10
14
|
* @inheritDoc CCF.wrapKey
|
|
11
15
|
*/
|
package/crypto.js
CHANGED
|
@@ -22,6 +22,10 @@ export const generateAesKey = ccf.generateAesKey;
|
|
|
22
22
|
* @inheritDoc CCF.generateRsaKeyPair
|
|
23
23
|
*/
|
|
24
24
|
export const generateRsaKeyPair = ccf.generateRsaKeyPair;
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc CCF.generateEcdsaKeyPair
|
|
27
|
+
*/
|
|
28
|
+
export const generateEcdsaKeyPair = ccf.generateEcdsaKeyPair;
|
|
25
29
|
/**
|
|
26
30
|
* @inheritDoc CCF.wrapKey
|
|
27
31
|
*/
|
package/global.d.ts
CHANGED
|
@@ -321,6 +321,12 @@ export interface CCF {
|
|
|
321
321
|
* @param exponent The public exponent. Default: 65537.
|
|
322
322
|
*/
|
|
323
323
|
generateRsaKeyPair(size: number, exponent?: number): CryptoKeyPair;
|
|
324
|
+
/**
|
|
325
|
+
* Generate an ECDSA key pair.
|
|
326
|
+
*
|
|
327
|
+
* @param curve The name of the curve, one of "secp256r1", "secp384r1".
|
|
328
|
+
*/
|
|
329
|
+
generateEcdsaKeyPair(curve: string): CryptoKeyPair;
|
|
324
330
|
/**
|
|
325
331
|
* Wraps a key using a wrapping key.
|
|
326
332
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/ccf-app",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-dev5",
|
|
4
4
|
"description": "CCF app support package",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"license": "Apache-2.0",
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/chai": "^4.2.15",
|
|
22
|
-
"@types/mocha": "^
|
|
22
|
+
"@types/mocha": "^10.0.0",
|
|
23
23
|
"@types/node": "^18.0.0",
|
|
24
24
|
"@types/node-forge": "^1.0.0",
|
|
25
25
|
"chai": "^4.3.4",
|
package/polyfill.js
CHANGED
|
@@ -151,6 +151,23 @@ class CCFPolyfill {
|
|
|
151
151
|
});
|
|
152
152
|
return rsaKeyPair;
|
|
153
153
|
}
|
|
154
|
+
generateEcdsaKeyPair(curve) {
|
|
155
|
+
var curve_name = curve;
|
|
156
|
+
if (curve == "secp256r1")
|
|
157
|
+
curve_name = "prime256v1";
|
|
158
|
+
const ecdsaKeyPair = crypto.generateKeyPairSync("ec", {
|
|
159
|
+
namedCurve: curve_name,
|
|
160
|
+
publicKeyEncoding: {
|
|
161
|
+
type: "spki",
|
|
162
|
+
format: "pem",
|
|
163
|
+
},
|
|
164
|
+
privateKeyEncoding: {
|
|
165
|
+
type: "pkcs8",
|
|
166
|
+
format: "pem",
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
return ecdsaKeyPair;
|
|
170
|
+
}
|
|
154
171
|
wrapKey(key, wrappingKey, parameters) {
|
|
155
172
|
if (parameters.name === "RSA-OAEP") {
|
|
156
173
|
return nodeBufToArrBuf(crypto.publicEncrypt({
|