Skip to content

Commit dca474c

Browse files
authored
x509-verification: drop cryptography-key-parsing dependency (#14272)
Move the Pkcs1RsaPublicKey ASN.1 struct into cryptography-x509::common (next to SubjectPublicKeyInfo, where it naturally belongs) so that cryptography-x509-verification no longer depends on cryptography-key-parsing. This removes the transitive dependency on openssl-sys, making cryptography-x509-verification usable with alternative crypto backends (e.g. aws-lc-rs) without requiring OpenSSL headers or libraries.
1 parent 14cfa57 commit dca474c

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/rust/cryptography-key-parsing/src/rsa.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44

55
use crate::{KeyParsingError, KeyParsingResult, KeySerializationResult};
66

7-
#[derive(asn1::Asn1Read, asn1::Asn1Write)]
8-
pub struct Pkcs1RsaPublicKey<'a> {
9-
pub n: asn1::BigUint<'a>,
10-
pub e: asn1::BigUint<'a>,
11-
}
7+
use cryptography_x509::common::Pkcs1RsaPublicKey;
128

139
// RFC 8017, Section A.1.2
1410
#[derive(asn1::Asn1Read, asn1::Asn1Write)]

src/rust/cryptography-x509-verification/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ license.workspace = true
1010
[dependencies]
1111
asn1.workspace = true
1212
cryptography-x509 = { path = "../cryptography-x509" }
13-
cryptography-key-parsing = { path = "../cryptography-key-parsing" }
1413

1514
[dev-dependencies]
1615
pem.workspace = true

src/rust/cryptography-x509-verification/src/policy/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use std::ops::{Deref, Range};
99
use std::sync::{Arc, LazyLock};
1010

1111
use asn1::ObjectIdentifier;
12-
use cryptography_key_parsing::rsa::Pkcs1RsaPublicKey;
1312
use cryptography_x509::certificate::Certificate;
13+
use cryptography_x509::common::Pkcs1RsaPublicKey;
1414
use cryptography_x509::common::{
1515
AlgorithmIdentifier, AlgorithmParameters, EcParameters, RsaPssParameters, Time,
1616
PSS_SHA256_HASH_ALG, PSS_SHA256_MASK_GEN_ALG, PSS_SHA384_HASH_ALG, PSS_SHA384_MASK_GEN_ALG,

src/rust/cryptography-x509/src/common.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ pub struct SubjectPublicKeyInfo<'a> {
192192
pub subject_public_key: asn1::BitString<'a>,
193193
}
194194

195+
#[derive(asn1::Asn1Read, asn1::Asn1Write)]
196+
pub struct Pkcs1RsaPublicKey<'a> {
197+
pub n: asn1::BigUint<'a>,
198+
pub e: asn1::BigUint<'a>,
199+
}
200+
195201
#[derive(asn1::Asn1Read, asn1::Asn1Write, PartialEq, Eq, Hash, Clone)]
196202
pub struct AttributeTypeValue<'a> {
197203
pub type_id: asn1::ObjectIdentifier,

0 commit comments

Comments
 (0)