Skip to content

Commit

Permalink
rust: Remove unused PolicyError variants
Browse files Browse the repository at this point in the history
  • Loading branch information
tetsuo-cpp committed Oct 27, 2023
1 parent 1ba15dd commit e695840
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
23 changes: 1 addition & 22 deletions src/rust/cryptography-x509-validation/src/policy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use cryptography_x509::common::{
PSS_SHA256_MASK_GEN_ALG, PSS_SHA384_HASH_ALG, PSS_SHA384_MASK_GEN_ALG, PSS_SHA512_HASH_ALG,
PSS_SHA512_MASK_GEN_ALG,
};
use cryptography_x509::extensions::{DuplicateExtensionsError, SubjectAlternativeName};
use cryptography_x509::extensions::SubjectAlternativeName;
use cryptography_x509::name::GeneralName;
use cryptography_x509::oid::{
BASIC_CONSTRAINTS_OID, EKU_SERVER_AUTH_OID, KEY_USAGE_OID, SUBJECT_ALTERNATIVE_NAME_OID,
Expand Down Expand Up @@ -113,31 +113,10 @@ const RFC5280_CRITICAL_CA_EXTENSIONS: &[asn1::ObjectIdentifier] =
const RFC5280_CRITICAL_EE_EXTENSIONS: &[asn1::ObjectIdentifier] =
&[BASIC_CONSTRAINTS_OID, SUBJECT_ALTERNATIVE_NAME_OID];

#[derive(Debug, PartialEq, Eq)]
pub enum PolicyError {
Malformed(asn1::ParseError),
DuplicateExtension(DuplicateExtensionsError),
Other(&'static str),
}

impl From<asn1::ParseError> for PolicyError {
fn from(value: asn1::ParseError) -> Self {
Self::Malformed(value)
}
}

impl From<DuplicateExtensionsError> for PolicyError {
fn from(value: DuplicateExtensionsError) -> Self {
Self::DuplicateExtension(value)
}
}

impl From<&'static str> for PolicyError {
fn from(value: &'static str) -> Self {
Self::Other(value)
}
}

/// Represents a logical certificate "subject," i.e. a principal matching
/// one of the names listed in a certificate's `subjectAltNames` extension.
pub enum Subject<'a> {
Expand Down
2 changes: 1 addition & 1 deletion src/rust/cryptography-x509/src/extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::common;
use crate::crl;
use crate::name;

#[derive(Debug, PartialEq, Eq)]
#[derive(Debug)]
pub struct DuplicateExtensionsError(pub asn1::ObjectIdentifier);

pub type RawExtensions<'a> = common::Asn1ReadableOrWritable<
Expand Down

0 comments on commit e695840

Please sign in to comment.