@microsoft/ccf-app 5.0.1 → 5.0.3

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/global.d.ts CHANGED
@@ -188,14 +188,18 @@ export interface CryptoKeyPair {
188
188
  */
189
189
  publicKey: string;
190
190
  }
191
- export type AlgorithmName = "RSASSA-PKCS1-v1_5" | "ECDSA" | "EdDSA" | "HMAC";
191
+ export type AlgorithmName = "RSA-PSS" | "ECDSA" | "EdDSA" | "HMAC";
192
192
  export type DigestAlgorithm = "SHA-256" | "SHA-384" | "SHA-512";
193
193
  export interface SigningAlgorithm {
194
194
  name: AlgorithmName;
195
195
  /**
196
- * Digest algorithm. It's necessary for "RSASSA-PKCS1-v1_5", "ECDSA", and "HMAC"
196
+ * Digest algorithm. It's necessary for "RSA-PSS", "ECDSA", and "HMAC"
197
197
  */
198
198
  hash?: DigestAlgorithm;
199
+ /**
200
+ * Salt length, necessary for "RSA-PSS".
201
+ */
202
+ saltLength?: number;
199
203
  }
200
204
  /**
201
205
  * Interfaces for JSON Web Key objects, as per [RFC7517](https://www.rfc-editor.org/rfc/rfc7517).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/ccf-app",
3
- "version": "5.0.1",
3
+ "version": "5.0.3",
4
4
  "description": "CCF app support package",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -20,7 +20,7 @@
20
20
  "devDependencies": {
21
21
  "@types/chai": "^4.2.15",
22
22
  "@types/mocha": "^10.0.0",
23
- "@types/node": "^20.1.0",
23
+ "@types/node": "^22.0.0",
24
24
  "@types/node-forge": "^1.0.0",
25
25
  "chai": "^5.0.0",
26
26
  "colors": "1.4.0",
package/polyfill.js CHANGED
@@ -103,8 +103,8 @@ class CCFPolyfill {
103
103
  let padding = undefined;
104
104
  const privKey = jscrypto.createPrivateKey(key);
105
105
  if (privKey.asymmetricKeyType == "rsa") {
106
- if (algorithm.name === "RSASSA-PKCS1-v1_5") {
107
- padding = jscrypto.constants.RSA_PKCS1_PADDING;
106
+ if (algorithm.name === "RSA-PSS") {
107
+ padding = jscrypto.constants.RSA_PKCS1_PSS_PADDING;
108
108
  }
109
109
  else {
110
110
  throw new Error("incompatible signing algorithm for given key type");
@@ -133,14 +133,15 @@ class CCFPolyfill {
133
133
  key: privKey,
134
134
  dsaEncoding: "ieee-p1363",
135
135
  padding: padding,
136
+ saltLength: algorithm.saltLength ?? 0,
136
137
  });
137
138
  },
138
139
  verifySignature(algorithm, key, signature, data) {
139
140
  let padding = undefined;
140
141
  const pubKey = jscrypto.createPublicKey(key);
141
142
  if (pubKey.asymmetricKeyType == "rsa") {
142
- if (algorithm.name === "RSASSA-PKCS1-v1_5") {
143
- padding = jscrypto.constants.RSA_PKCS1_PADDING;
143
+ if (algorithm.name === "RSA-PSS") {
144
+ padding = jscrypto.constants.RSA_PKCS1_PSS_PADDING;
144
145
  }
145
146
  else {
146
147
  throw new Error("incompatible signing algorithm for given key type");
@@ -169,6 +170,7 @@ class CCFPolyfill {
169
170
  key: pubKey,
170
171
  dsaEncoding: "ieee-p1363",
171
172
  padding: padding,
173
+ saltLength: algorithm.saltLength ?? 0,
172
174
  }, new Uint8Array(signature));
173
175
  },
174
176
  generateAesKey(size) {