Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.

Elliptic p256 compatibility support#634

Merged
bradlhart merged 3 commits intodevelopfrom
p256-ecurve-compatibility
Jan 3, 2020
Merged

Elliptic p256 compatibility support#634
bradlhart merged 3 commits intodevelopfrom
p256-ecurve-compatibility

Conversation

@bradlhart
Copy link
Copy Markdown
Contributor

@bradlhart bradlhart commented Dec 20, 2019

Change Description

Adjusting the existing PrivateKey, PublicKey, Signature, and JsSignatureProvider to use p256 r1 format keys if optional arguments are provided, such as the r1 KeyType from numeric and elliptic constructed with p256. K1 format and secp256k1 are default if no ecurve/keyType are provided.

API Changes

  • API Changes
    PrivateKey.getType() => returns private variable this.key.type
    PublicKey.getType() => returns private variable this.key.type
    Signature.getType() => returns private variable this.signature.type

Documentation Additions

  • Documentation Additions

@bradlhart bradlhart force-pushed the p256-ecurve-compatibility branch from 1f7b023 to 72f984a Compare December 26, 2019 19:31

public getType(): KeyType {
return this.key.type;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also an API change; I'd run this past Todd, but this is a change that 1) is an addition and 2) is not implementation specific. So I think I'm fine with it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the initial PR description to note the API changes.

/** Instantiate private key from an `elliptic`-format private key */
public static fromElliptic(privKey: ec.KeyPair, keyType = KeyType.k1): PrivateKey {
const privArray = privKey.getPrivate().toArray();
public static fromElliptic(privKey: ec.KeyPair, keyType: KeyType): PrivateKey {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that removing the default from this argument makes this PR a breaking change.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file isn't in v20

@bradlhart bradlhart merged commit b3eb443 into develop Jan 3, 2020
@bradlhart bradlhart deleted the p256-ecurve-compatibility branch January 3, 2020 17:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants