Skip to content

Commit ed94a9b

Browse files
committed
Added secp521r1 support
1 parent 1d7d230 commit ed94a9b

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Rationale: In many situations, it is required to use non-exportable private cert
1313
from the Windows certificate store instead of the external PKCS8 file.
1414
`rustls-cng` can use such chains in the `rustls` context.
1515

16-
Supported key/certificate types: **RSA**, **ECDSA/ECDH**. Supported elliptic curves: secp256r1 (prime256v1), secp384r1.
16+
Supported key/certificate types: **RSA**, **ECDSA/ECDH**. Supported elliptic curves: secp256r1 (prime256v1), secp384r1, secp521r1.
1717

1818
[Documentation](https://docs.rs/rustls-cng).
1919

src/signer.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ impl CngSigningKey {
126126
AlgorithmGroup::Ecdsa | AlgorithmGroup::Ecdh => match self.bits {
127127
256 => &[SignatureScheme::ECDSA_NISTP256_SHA256],
128128
384 => &[SignatureScheme::ECDSA_NISTP384_SHA384],
129+
521 => &[SignatureScheme::ECDSA_NISTP521_SHA512],
129130
_ => &[],
130131
},
131132
}
@@ -160,6 +161,9 @@ impl CngSigner {
160161
SignatureScheme::ECDSA_NISTP384_SHA384 => {
161162
(BCRYPT_SHA384_ALG_HANDLE, SignaturePadding::None)
162163
}
164+
SignatureScheme::ECDSA_NISTP521_SHA512 => {
165+
(BCRYPT_SHA512_ALG_HANDLE, SignaturePadding::None)
166+
}
163167
_ => return Err(Error::General("Unsupported signature scheme".to_owned())),
164168
};
165169

tests/test_sign.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ fn test_sign() {
2525
SignatureScheme::RSA_PSS_SHA512,
2626
SignatureScheme::ECDSA_NISTP256_SHA256,
2727
SignatureScheme::ECDSA_NISTP384_SHA384,
28+
SignatureScheme::ECDSA_NISTP521_SHA512,
2829
];
2930

3031
let key = context.acquire_key(true).unwrap();

0 commit comments

Comments
 (0)