File: fix-for-openssl-3.patch

package info (click to toggle)
node-trust-webcrypto 0.9.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,156 kB
  • sloc: javascript: 9,995; makefile: 13; sh: 1
file content (40 lines) | stat: -rw-r--r-- 1,389 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From: Xavier Guimard <yadd@debian.org>
Date: mars, 11 2026 19:09:30 +0100
Subject: [PATCH] fix for openssl 3
Bug-Debian: https://bugs.debian.org/1002262
Forwarded: not-needed

--- a/src/algorithms/ECDSA.js
+++ b/src/algorithms/ECDSA.js
@@ -278,6 +278,13 @@
 
       // 2.3.9.1. If namedCurve is equal to 'secp256k1' then...
       if (EcKeyAlgorithm.mapping.map(alg => alg.namedCurve).includes(namedCurve)){
+
+        // Convert curve name for keyto compatibility (K-256 -> secp256k1)
+        let jwkForKeyto = jwk
+        if (jwk.crv === 'K-256') {
+          jwkForKeyto = { ...jwk, crv: 'secp256k1' }
+        }
+
         // 2.3.9.1.1-3 Ommited due to redundancy
         // 2.3.9.1.4.1. Validate 'd' property
         if (jwk.d) {
@@ -287,7 +294,7 @@
               type: 'private',
               extractable,
               usages: ['sign'],
-              handle: keyto.from(jwk, 'jwk').toString('pem', 'private_pkcs1')
+              handle: keyto.from(jwkForKeyto, 'jwk').toString('pem', 'private_pkcs1')
           })
         }
         // 2.3.9.1.4.2. Otherwise...
@@ -298,7 +305,7 @@
             type: 'public',
             extractable: true,
             usages: ['verify'],
-            handle: keyto.from(jwk, 'jwk').toString('pem', 'public_pkcs8')
+            handle: keyto.from(jwkForKeyto, 'jwk').toString('pem', 'public_pkcs8')
           })
         }
       }