-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use elliptic instead of @noble/curves for Node crypto (#629)
@noble/curves makes use of @noble/hashes, which does not function correctly on big-endian systems, and also throws an error on module load if a big-endian system is detected. Revert to using elliptic as the ECDSA signing implementation. Signed-off-by: Mark S. Lewis <[email protected]>
- Loading branch information
1 parent
5fe4c4f
commit f75f440
Showing
7 changed files
with
97 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright IBM Corp. All Rights Reserved. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/* eslint-disable */ | ||
// @ts-nocheck | ||
|
||
import { define } from 'asn1.js'; | ||
import BN from 'bn.js'; | ||
|
||
const ECSignature = define('ECSignature', function() { | ||
return this.seq().obj( | ||
this.key('r').int(), | ||
this.key('s').int() | ||
); | ||
}); | ||
|
||
export function ecSignatureAsDER(r: BN, s: BN): Uint8Array { | ||
return new Uint8Array(ECSignature.encode({ r, s }, 'der')); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters