Browse Source

update comment

tags/v1.0.0
AJ ONeal 11 months ago
parent
commit
17021fa2cb
1 changed files with 6 additions and 5 deletions
  1. 6
    5
      lib/ec.js

+ 6
- 5
lib/ec.js View File

@@ -1,12 +1,13 @@
1 1
 'use strict';
2 2
 
3
+var x509 = module.exports;
4
+
3 5
 var ASN1 = require('./asn1-packer.js');
4 6
 var Enc = require('./encoding.js');
5
-var x509 = module.exports;
6 7
 
7 8
 // 1.2.840.10045.3.1.7
8 9
 // prime256v1 (ANSI X9.62 named elliptic curve)
9
-var OBJ_ID_EC  = '06 08 2A8648CE3D030107'.replace(/\s+/g, '').toLowerCase();
10
+var OBJ_ID_EC_256  = '06 08 2A8648CE3D030107'.replace(/\s+/g, '').toLowerCase();
10 11
 // 1.3.132.0.34
11 12
 // secp384r1 (SECG (Certicom) named elliptic curve)
12 13
 var OBJ_ID_EC_384 = '06 05 2B81040022'.replace(/\s+/g, '').toLowerCase();
@@ -18,7 +19,7 @@ x509.packSec1 = function (jwk) {
18 19
   var d = Enc.base64ToHex(jwk.d);
19 20
   var x = Enc.base64ToHex(jwk.x);
20 21
   var y = Enc.base64ToHex(jwk.y);
21
-  var objId = ('P-256' === jwk.crv) ? OBJ_ID_EC : OBJ_ID_EC_384;
22
+  var objId = ('P-256' === jwk.crv) ? OBJ_ID_EC_256 : OBJ_ID_EC_384;
22 23
   return Enc.hexToUint8(
23 24
     ASN1('30'
24 25
     , ASN1.UInt('01')
@@ -31,7 +32,7 @@ x509.packPkcs8 = function (jwk) {
31 32
   var d = Enc.base64ToHex(jwk.d);
32 33
   var x = Enc.base64ToHex(jwk.x);
33 34
   var y = Enc.base64ToHex(jwk.y);
34
-  var objId = ('P-256' === jwk.crv) ? OBJ_ID_EC : OBJ_ID_EC_384;
35
+  var objId = ('P-256' === jwk.crv) ? OBJ_ID_EC_256 : OBJ_ID_EC_384;
35 36
   return Enc.hexToUint8(
36 37
     ASN1('30'
37 38
     , ASN1.UInt('00')
@@ -49,7 +50,7 @@ x509.packPkcs8 = function (jwk) {
49 50
 x509.packSpki = function (jwk) {
50 51
   var x = Enc.base64ToHex(jwk.x);
51 52
   var y = Enc.base64ToHex(jwk.y);
52
-  var objId = ('P-256' === jwk.crv) ? OBJ_ID_EC : OBJ_ID_EC_384;
53
+  var objId = ('P-256' === jwk.crv) ? OBJ_ID_EC_256 : OBJ_ID_EC_384;
53 54
   return Enc.hexToUint8(
54 55
     ASN1('30'
55 56
     , ASN1('30'

Loading…
Cancel
Save