Skip to content

Commit d25b07c

Browse files
authored
ecdsa: forward AssociatedAlgorithmIdentifier impls (#698)
...from the `elliptic-curve` crate, as released in v0.13.3
1 parent 116528f commit d25b07c

File tree

4 files changed

+33
-6
lines changed

4 files changed

+33
-6
lines changed

Cargo.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ecdsa/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ edition = "2021"
1616
rust-version = "1.65"
1717

1818
[dependencies]
19-
elliptic-curve = { version = "0.13.2", default-features = false, features = ["digest", "sec1"] }
19+
elliptic-curve = { version = "0.13.3", default-features = false, features = ["digest", "sec1"] }
2020
signature = { version = "2.0, <2.2", default-features = false, features = ["rand_core"] }
2121

2222
# optional dependencies

ecdsa/src/signing.rs

+14
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ use crate::elliptic_curve::{
3636
self,
3737
der::AnyRef,
3838
spki::{AlgorithmIdentifier, AssociatedAlgorithmIdentifier, SignatureAlgorithmIdentifier},
39+
ObjectIdentifier,
3940
},
4041
sec1::{self, FromEncodedPoint, ToEncodedPoint},
4142
AffinePoint,
@@ -523,6 +524,19 @@ where
523524
type VerifyingKey = VerifyingKey<C>;
524525
}
525526

527+
#[cfg(feature = "pkcs8")]
528+
impl<C> AssociatedAlgorithmIdentifier for SigningKey<C>
529+
where
530+
C: AssociatedOid + CurveArithmetic + PrimeCurve,
531+
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
532+
SignatureSize<C>: ArrayLength<u8>,
533+
{
534+
type Params = ObjectIdentifier;
535+
536+
const ALGORITHM_IDENTIFIER: AlgorithmIdentifier<ObjectIdentifier> =
537+
SecretKey::<C>::ALGORITHM_IDENTIFIER;
538+
}
539+
526540
#[cfg(feature = "pkcs8")]
527541
impl<C> SignatureAlgorithmIdentifier for SigningKey<C>
528542
where

ecdsa/src/verifying.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use elliptic_curve::pkcs8::{
3434
self,
3535
der::AnyRef,
3636
spki::{AlgorithmIdentifier, AssociatedAlgorithmIdentifier, SignatureAlgorithmIdentifier},
37-
AssociatedOid,
37+
AssociatedOid, ObjectIdentifier,
3838
};
3939

4040
#[cfg(feature = "sha2")]
@@ -384,6 +384,19 @@ where
384384
}
385385
}
386386

387+
#[cfg(feature = "pkcs8")]
388+
impl<C> AssociatedAlgorithmIdentifier for VerifyingKey<C>
389+
where
390+
C: AssociatedOid + CurveArithmetic + PrimeCurve,
391+
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
392+
FieldBytesSize<C>: sec1::ModulusSize,
393+
{
394+
type Params = ObjectIdentifier;
395+
396+
const ALGORITHM_IDENTIFIER: AlgorithmIdentifier<ObjectIdentifier> =
397+
PublicKey::<C>::ALGORITHM_IDENTIFIER;
398+
}
399+
387400
#[cfg(feature = "pkcs8")]
388401
impl<C> SignatureAlgorithmIdentifier for VerifyingKey<C>
389402
where

0 commit comments

Comments
 (0)