HomePhabricator

[ecash-lib] Add `payment` with `asn1` and `x509`

Description

[ecash-lib] Add payment with asn1 and x509

Summary:
Allows parsing X509 certificates. This is needed for verifying BIP70 PaymentRequests.

This is based on:

Names for the OID variables have been taken from https://oid-base.com/ (screaming snake case-ified). This is the reason why the OID constant of the secp256k1 curve is called OID_ANSIP256K1, because that's the official name.

Depends on D17733.

Test Plan:
npm test

Also, consider creating your own certificate and verify its signature using Ecc:

  1. openssl ecparam -genkey -out key.pem -name secp256k1
  2. openssl req -x509 -new -key key.pem -out cert.pem -sha256 -days 36500 -nodes -subj "/C=CA/ST=British Columbia/L=Vancouver/O=eCash Palace/OU=Software/CN=example.e.cash/emailAddress=example@e.cash"
  3. Replace the contents of the CERT variable with the inner content of cert.pem (without BEGIN CERTIFICATE)
  4. npm test -- -g 'asn1.readCert', and update some of the variables

Reviewers: bytesofman, #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D17734

Details

Provenance
tobias_ruckAuthored on Sun, Mar 2, 22:11
tobias_ruckPushed on Sat, Mar 15, 08:21
Reviewer
Restricted Project
Differential Revision
D17734: [ecash-lib] Add `payment` with `asn1` and `x509`
Parents
rABCd0ecde3d1500: [ecash-wallet] Add method to get spendable sats utxos
Branches
Unknown
Tags
Unknown