0.0.4 • Published 7 years ago

simple-ecdsa v0.0.4

Weekly downloads
1
License
ISC
Repository
-
Last release
7 years ago

Simple ECDSA library

A simple ECDSA library can:

  • Generate KeyPairs
  • Sign & Verify
  • Currently Supports Curve P256
  • Keys and signature are encoded from string -> DER of ASN.1 -> Hex.
  • Supports import of DER-ASN.1->Hex encoded keys.

Example

let s = new SimpleECDSA(CurveP265)
let privKey = s.getPrivKey()         // DER-ASN.1->Hex
let sig = s.sign("hello")            // DER-ASN.1->Hex signature
let verified = SimpleECDSA.verify(s.getPubKey(), CurveP265, "hello", sig)
console.log(verified)

# Other methods
SimpleECDSA.genKey()                // refresh the internal key in SimpleECDSA instance
SimpleECDSA.getPrivKey()            // get the private key
SimpleECDSA.loadFromPubKey(key, CurveP265)     // import a DER-ASN.1->Hex encode public key
SimpleECDSA.loadFromPrivKey(key, CurveP265)    // import a DER-ASN.1->Hex encode private key
SimpleECDSA.isValidPubKey(key)      // Check whether a public key can be decoded to a CurveP265 public key.
0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago