Skip to content

Commit

Permalink
Bump to rust-asn1 0.6.0 (pyca#6175)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex authored Jul 17, 2021
1 parent 69f9a41 commit b681f3c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ publish = false
[dependencies]
lazy_static = "1"
pyo3 = { version = "0.14.1" }
asn1 = { version = "0.5.3", default-features = false, features = ["derive"] }
asn1 = { version = "0.6", default-features = false, features = ["derive"] }
chrono = { version = "0.4", default-features = false, features = ["alloc"] }
ouroboros = "0.10"

Expand Down
10 changes: 5 additions & 5 deletions src/rust/src/x509.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,9 @@ struct UnvalidatedIA5String<'a>(&'a str);
impl<'a> asn1::SimpleAsn1Readable<'a> for UnvalidatedIA5String<'a> {
const TAG: u8 = 0x16;
fn parse_data(data: &'a [u8]) -> asn1::ParseResult<Self> {
Ok(UnvalidatedIA5String(
std::str::from_utf8(data).map_err(|_| asn1::ParseError::InvalidValue)?,
))
Ok(UnvalidatedIA5String(std::str::from_utf8(data).map_err(
|_| asn1::ParseError::new(asn1::ParseErrorKind::InvalidValue),
)?))
}
}

Expand Down Expand Up @@ -500,8 +500,8 @@ fn parse_name_attribute(
.import("cryptography.x509.name")?
.getattr("_ASN1_TYPE_TO_ENUM")?;
let py_tag = tag_enum.get_item(attribute.value.tag().to_object(py))?;
let py_data =
std::str::from_utf8(attribute.value.data()).map_err(|_| asn1::ParseError::InvalidValue)?;
let py_data = std::str::from_utf8(attribute.value.data())
.map_err(|_| asn1::ParseError::new(asn1::ParseErrorKind::InvalidValue))?;
Ok(x509_module
.call_method1("NameAttribute", (oid, py_data, py_tag))?
.to_object(py))
Expand Down

0 comments on commit b681f3c

Please sign in to comment.