Skip to content

Commit a015f16

Browse files
committed
add secp256k1 key pair type
1 parent 5bca9e5 commit a015f16

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

cryptography/lib/src/cryptography/key_pair_type.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ class KeyPairType<S extends KeyPairData, P extends PublicKey> {
3535
webCryptoCurve: 'P-256',
3636
);
3737

38+
/// Key pair type for [Ecdh] and [Ecdsa] with P-256 curve.
39+
///
40+
/// Keys of this type can be generated with [EcKeyPairGenerator].
41+
static const KeyPairType p256k = KeyPairType<EcKeyPairData, EcPublicKey>._(
42+
name: 'p256k',
43+
ellipticBits: 256,
44+
webCryptoCurve: 'P-256K',
45+
);
46+
3847
/// Key pair type for [Ecdh] and [Ecdsa] with P-384 curve.
3948
///
4049
/// Keys of this type can be generated with [EcKeyPairGenerator].

jwk/lib/jwk.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,7 @@ class Jwk {
606606
if (publicKey is EcPublicKey) {
607607
final crv = const <KeyPairType, String>{
608608
KeyPairType.p256: 'P-256',
609+
KeyPairType.p256k: 'secp256k1',
609610
KeyPairType.p384: 'P-384',
610611
KeyPairType.p521: 'P-521',
611612
}[publicKey.type];

0 commit comments

Comments
 (0)