Skip to content

Commit

Permalink
pyo3: bump to version 0.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshilliard committed Jul 4, 2021
1 parent 665126d commit e2ad0ef
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 134 deletions.
74 changes: 23 additions & 51 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 @@ -7,7 +7,7 @@ publish = false

[dependencies]
lazy_static = "1"
pyo3 = { version = "0.13.1" }
pyo3 = { version = "0.14.0" }
asn1 = { version = "0.5.3", default-features = false, features = ["derive"] }
chrono = { version = "0.4", default-features = false, features = ["alloc"] }
ouroboros = "0.9"
Expand Down
16 changes: 7 additions & 9 deletions src/rust/src/ocsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,14 @@ impl OCSPRequest {

let hashes = py.import("cryptography.hazmat.primitives.hashes")?;
match OIDS_TO_HASH.get(&cert_id.hash_algorithm.oid) {
Some(alg_name) => Ok(hashes.call0(alg_name)?),
Some(alg_name) => Ok(hashes.getattr(alg_name)?.call0()?),
None => {
let exceptions = py.import("cryptography.exceptions")?;
Err(PyAsn1Error::from(pyo3::PyErr::from_instance(
exceptions.call1(
"UnsupportedAlgorithm",
(format!(
"Signature algorithm OID: {} not recognized",
cert_id.hash_algorithm.oid
),),
)?,
exceptions.getattr("UnsupportedAlgorithm")?.call1((format!(
"Signature algorithm OID: {} not recognized",
cert_id.hash_algorithm.oid
),))?,
)))
}
}
Expand Down Expand Up @@ -233,7 +230,8 @@ fn parse_ocsp_singleresp_extension(
let contents = asn1::parse_single::<&[u8]>(ext_data)?;
let scts = x509::parse_scts(py, contents, x509::LogEntryType::Certificate)?;
Ok(x509_module
.call1("SignedCertificateTimestamps", (scts,))?
.getattr("SignedCertificateTimestamps")?
.call1((scts,))?
.to_object(py))
} else {
x509::parse_crl_entry_extension(py, der_oid, ext_data)
Expand Down
Loading

0 comments on commit e2ad0ef

Please sign in to comment.