diff --git a/rust/Cargo.lock b/rust/Cargo.lock index cac8eb0..b817979 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -4,18 +4,19 @@ version = 3 [[package]] name = "asn1" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3522623dbb7db59b34439c022ab0445a0257a62ad20d499da3a3507394708559" +checksum = "18d97d0d2e60ad0595a73b82264dcd46c2f96769b0f555ae71c14122f0679f65" dependencies = [ "asn1_derive", + "itoa", ] [[package]] name = "asn1_derive" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da79157fc864ed738b596d622929466c68ed48371f17a5f05e329880420a160d" +checksum = "00cec5ab4e9217b82bdd194bf6a4c74890a7e6d530159546bd83684f42211b8a" dependencies = [ "proc-macro2", "quote", @@ -86,7 +87,7 @@ dependencies = [ [[package]] name = "cryptography-x509" version = "0.1.0" -source = "git+https://github.com/pyca/cryptography.git?rev=a63ca251a7aa8a5aac6153e0b69083cb05e1a6d0#a63ca251a7aa8a5aac6153e0b69083cb05e1a6d0" +source = "git+https://github.com/pyca/cryptography.git?rev=4c72f368234e60a06e4a0beaf87be55940dd49c1#4c72f368234e60a06e4a0beaf87be55940dd49c1" dependencies = [ "asn1", ] @@ -155,6 +156,12 @@ version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + [[package]] name = "libc" version = "0.2.158" @@ -256,9 +263,9 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.22.6" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f402062616ab18202ae8319da13fa4279883a2b8a9d9f83f20dbade813ce1884" +checksum = "7ebb0c0cc0de9678e53be9ccf8a2ab53045e6e3a8be03393ceccc5e7396ccb40" dependencies = [ "cfg-if", "indoc", @@ -274,9 +281,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.22.6" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b14b5775b5ff446dd1056212d778012cbe8a0fbffd368029fd9e25b514479c38" +checksum = "80e3ce69c4ec34476534b490e412b871ba03a82e35604c3dfb95fcb6bfb60c09" dependencies = [ "once_cell", "target-lexicon", @@ -284,9 +291,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.22.6" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ab5bcf04a2cdcbb50c7d6105de943f543f9ed92af55818fd17b660390fc8636" +checksum = "3b09f311c76b36dfd6dd6f7fa6f9f18e7e46a1c937110d283e80b12ba2468a75" dependencies = [ "libc", "pyo3-build-config", @@ -294,9 +301,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.22.6" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fd24d897903a9e6d80b968368a34e1525aeb719d568dba8b3d4bfa5dc67d453" +checksum = "fd4f74086536d1e1deaff99ec0387481fb3325c82e4e48be0e75ab3d3fcb487a" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -306,9 +313,9 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.22.6" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c011a03ba1e50152b4b394b479826cad97e7a21eb52df179cd91ac411cbfbe" +checksum = "9e77dfeb76b32bbf069144a5ea0a36176ab59c8db9ce28732d0f06f096bbfbc8" dependencies = [ "heck", "proc-macro2", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index d7dcdc2..ff92df8 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -14,13 +14,13 @@ crate-type = ["cdylib"] [dependencies] tsp-asn1 = { path = "tsp-asn1" } -pyo3 = { version = "0.22.6", features = ["abi3"] } -asn1 = "0.18" +pyo3 = { version = "0.23.1", features = ["abi3"] } +asn1 = "0.19" self_cell = "1" hex = "0.4" sha2 = "0.10.8" rand = "0.8.5" -cryptography-x509 = { git = "https://github.com/pyca/cryptography.git", rev = "a63ca251a7aa8a5aac6153e0b69083cb05e1a6d0" } +cryptography-x509 = { git = "https://github.com/pyca/cryptography.git", rev = "4c72f368234e60a06e4a0beaf87be55940dd49c1" } openssl = { version = "0.10.68", features = ["vendored"] } [features] diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 531da6f..cf3f98f 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -36,7 +36,7 @@ impl TimeStampReq { match self.raw.borrow_dependent().nonce { Some(nonce) => { let py_nonce = crate::util::big_asn1_uint_to_py(py, nonce)?; - Ok(Some(py_nonce.into_py(py))) + Ok(Some(py_nonce.into_pyobject(py)?.into_any().unbind())) } None => Ok(None), } @@ -47,7 +47,7 @@ impl TimeStampReq { match &self.raw.borrow_dependent().req_policy { Some(req_policy) => { let py_oid = crate::util::oid_to_py_oid(py, &req_policy)?; - Ok(Some(py_oid.into_py(py))) + Ok(Some(py_oid.into_pyobject(py)?.into_any().unbind())) } None => Ok(None), } @@ -71,7 +71,7 @@ impl TimeStampReq { .position(|window| window == message_imprint) { let slice = &full_bytes[offset..offset + message_imprint.len()]; - let new_owner = pyo3::types::PyBytes::new_bound(py, slice); + let new_owner = pyo3::types::PyBytes::new(py, slice); Ok(PyMessageImprint { contents: OwnedMessageImprint::try_new(new_owner.as_unbound().clone_ref(py), |v| { asn1::parse_single::(v.as_bytes(py)) @@ -91,7 +91,7 @@ impl TimeStampReq { ) -> PyResult> { let result = asn1::write_single(&self.raw.borrow_dependent()); match result { - Ok(request_bytes) => Ok(pyo3::types::PyBytes::new_bound(py, &request_bytes)), + Ok(request_bytes) => Ok(pyo3::types::PyBytes::new(py, &request_bytes)), Err(e) => Err(pyo3::exceptions::PyValueError::new_err(format!("{e}"))), } } @@ -151,7 +151,7 @@ impl PyMessageImprint { py: pyo3::Python<'p>, ) -> pyo3::PyResult> { let message = self.contents.borrow_dependent().hashed_message; - Ok(pyo3::types::PyBytes::new_bound(py, message)) + Ok(pyo3::types::PyBytes::new(py, message)) } } @@ -183,14 +183,14 @@ impl TimeStampResp { let opt_status_strings = &self.raw.borrow_dependent().status.status_string; match opt_status_strings { Some(status_strings) => { - let status_list = pyo3::types::PyList::empty_bound(py); + let status_list = pyo3::types::PyList::empty(py); for status_string in status_strings.clone() { - let _ = status_list - .append(pyo3::types::PyString::new_bound(py, status_string.as_str())); + let _ = + status_list.append(pyo3::types::PyString::new(py, status_string.as_str())); } Ok(status_list) } - None => Ok(pyo3::types::PyList::empty_bound(py)), + None => Ok(pyo3::types::PyList::empty(py)), } } @@ -222,7 +222,7 @@ impl TimeStampResp { .position(|window| window == tst_bytes) { let tst_slice = &full_bytes[offset..offset + tst_bytes.len()]; - let new_owner = pyo3::types::PyBytes::new_bound(py, tst_slice); + let new_owner = pyo3::types::PyBytes::new(py, tst_slice); let py_tstinfo = PyTSTInfo { raw: OwnedTSTInfo::try_new(new_owner.as_unbound().clone_ref(py), |v| { @@ -257,7 +257,7 @@ impl TimeStampResp { .position(|window| window == signed_data_bytes) { let tst_slice = &full_bytes[offset..offset + signed_data_bytes.len()]; - let new_owner = pyo3::types::PyBytes::new_bound(py, tst_slice); + let new_owner = pyo3::types::PyBytes::new(py, tst_slice); let py_signed_data = SignedData { raw: OwnedSignedData::try_new(new_owner.as_unbound().clone_ref(py), |v| { @@ -286,7 +286,7 @@ impl TimeStampResp { ) -> PyResult> { let result = asn1::write_single(&self.raw.borrow_dependent()); match result { - Ok(response_bytes) => Ok(pyo3::types::PyBytes::new_bound(py, &response_bytes)), + Ok(response_bytes) => Ok(pyo3::types::PyBytes::new(py, &response_bytes)), Err(e) => Err(pyo3::exceptions::PyValueError::new_err(format!("{e}"))), } } @@ -298,7 +298,7 @@ impl TimeStampResp { ) -> PyResult> { let result = asn1::write_single(&self.raw.borrow_dependent().time_stamp_token); match result { - Ok(request_bytes) => Ok(pyo3::types::PyBytes::new_bound(py, &request_bytes)), + Ok(request_bytes) => Ok(pyo3::types::PyBytes::new(py, &request_bytes)), Err(e) => Err(pyo3::exceptions::PyValueError::new_err(format!("{e}"))), } } @@ -347,7 +347,7 @@ impl SignedData { &self, py: pyo3::Python<'p>, ) -> pyo3::PyResult> { - let py_set = pyo3::types::PySet::empty_bound(py)?; + let py_set = pyo3::types::PySet::empty(py)?; for algorithm in self.raw.borrow_dependent().digest_algorithms.clone() { let py_oid = crate::util::oid_to_py_oid(py, algorithm.oid())?; py_set.add(py_oid)?; @@ -357,31 +357,28 @@ impl SignedData { } #[getter] - fn certificates<'p>( - &self, - py: pyo3::Python<'p>, - ) -> pyo3::PyResult> { - let py_certs = pyo3::types::PySet::empty_bound(py)?; + fn certificates<'p>(&self, py: pyo3::Python<'p>) -> pyo3::PyResult { + let py_certs = pyo3::types::PySet::empty(py)?; let certs = match self.raw.borrow_dependent().certificates.clone() { Some(certs) => certs, - None => return Ok(py_certs), + None => return Ok(py_certs.into_any().unbind()), }; for cert in certs { match cert { tsp_asn1::certificate::CertificateChoices::Certificate(cert) => { let raw = asn1::write_single(&cert).unwrap().clone(); - py_certs.add(pyo3::types::PyBytes::new_bound(py, &raw))?; + py_certs.add(pyo3::types::PyBytes::new(py, &raw))?; } _ => return Err(PyValueError::new_err("Unknown certificate type")), } } - Ok(py_certs) + Ok(py_certs.into_pyobject(py)?.into_any().unbind()) } #[getter] fn signer_infos<'p>(&self, py: pyo3::Python<'p>) -> pyo3::PyResult { - let py_set = pyo3::types::PySet::empty_bound(py)?; + let py_set = pyo3::types::PySet::empty(py)?; let full_bytes = self.raw.borrow_owner().as_bytes(py); for signer in self.raw.borrow_dependent().signer_infos.clone() { @@ -394,7 +391,7 @@ impl SignedData { .position(|window| window == signer_bytes) { let slice = &full_bytes[offset..offset + signer_bytes.len()]; - let new_owner = pyo3::types::PyBytes::new_bound(py, slice); + let new_owner = pyo3::types::PyBytes::new(py, slice); let py_signer_info = SignerInfo { raw: OwnedSignerInfo::try_new(new_owner.as_unbound().clone_ref(py), |v| { @@ -402,11 +399,11 @@ impl SignedData { }) .unwrap(), }; - py_set.add(py_signer_info.into_py(py))?; + py_set.add(py_signer_info.into_pyobject(py)?.unbind())?; } } - Ok(py_set.to_object(py)) + Ok(py_set.into_pyobject(py)?.into_any().unbind()) } } @@ -500,7 +497,7 @@ impl PyTSTInfo { match &self.raw.borrow_dependent().policy { Some(req_policy) => { let py_oid = crate::util::oid_to_py_oid(py, &req_policy)?; - Ok(Some(py_oid.into_py(py))) + Ok(Some(py_oid.into_pyobject(py)?.into_any().unbind())) } None => Ok(None), } @@ -519,7 +516,7 @@ impl PyTSTInfo { .position(|window| window == message_imprint) { let slice = &full_bytes[offset..offset + message_imprint.len()]; - let new_owner = pyo3::types::PyBytes::new_bound(py, slice); + let new_owner = pyo3::types::PyBytes::new(py, slice); Ok(PyMessageImprint { contents: OwnedMessageImprint::try_new(new_owner.as_unbound().clone_ref(py), |v| { asn1::parse_single::(v.as_bytes(py)) @@ -567,7 +564,7 @@ impl PyTSTInfo { match self.raw.borrow_dependent().nonce { Some(nonce) => { let py_nonce = crate::util::big_asn1_uint_to_py(py, nonce)?; - Ok(Some(py_nonce.into_py(py))) + Ok(Some(py_nonce.into_pyobject(py)?.into_any().unbind())) } None => Ok(None), } @@ -592,7 +589,7 @@ impl PyTSTInfo { ) -> PyResult> { let result = asn1::write_single(&self.raw.borrow_dependent()); match result { - Ok(request_bytes) => Ok(pyo3::types::PyBytes::new_bound(py, &request_bytes)), + Ok(request_bytes) => Ok(pyo3::types::PyBytes::new(py, &request_bytes)), Err(e) => Err(pyo3::exceptions::PyValueError::new_err(format!("{e}"))), } } @@ -659,7 +656,7 @@ pub(crate) fn create_timestamp_request( let request_bytes = asn1::write_single(×tamp_request) .map_err(|e| PyValueError::new_err(format!("Serialization error: {:?}", e))); - let py_bytes = pyo3::types::PyBytes::new_bound(py, &request_bytes.unwrap()).unbind(); + let py_bytes = pyo3::types::PyBytes::new(py, &request_bytes.unwrap()).unbind(); let raw = OwnedTimeStampReq::try_new(py_bytes, |data| asn1::parse_single(data.as_bytes(py))) .map_err(|e| { @@ -740,31 +737,26 @@ fn pkcs7_verify( /// A Python module implemented in Rust. #[pyo3::pymodule] -mod rfc3161_client { - use super::*; +mod _rust { - #[pyo3::pymodule] - mod _rust { - #[pymodule_export] - use super::parse_timestamp_response; + #[pymodule_export] + use super::parse_timestamp_response; - #[pymodule_export] - use super::create_timestamp_request; + #[pymodule_export] + use super::create_timestamp_request; - #[pymodule_export] - use super::parse_timestamp_request; + #[pymodule_export] + use super::parse_timestamp_request; - #[pymodule_export] - use super::{ - Accuracy, PyMessageImprint, PyTSTInfo, SignedData, SignerInfo, TimeStampReq, - TimeStampResp, - }; + #[pymodule_export] + use super::{ + Accuracy, PyMessageImprint, PyTSTInfo, SignedData, SignerInfo, TimeStampReq, TimeStampResp, + }; - #[pyo3::pymodule] - mod verify { - #[pymodule_export] - use super::super::pkcs7_verify; - } + #[pyo3::pymodule] + mod verify { + #[pymodule_export] + use super::super::pkcs7_verify; } } @@ -781,7 +773,7 @@ mod tests { let data = hex::decode("308202ec3003020100308202e306092a864886f70d010702a08202d4308202d0020103310d300b06096086480165030402013081d9060b2a864886f70d0109100104a081c90481c63081c302010106092b0601040183bf30023051300d0609608648016503040203050004409b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec04302143e2f3211f06695a6fb447d11dadf37b2228e8ca1180f32303234313030323039323135355a3003020101a034a4323030310e300c060355040a13056c6f63616c311e301c0603550403131554657374205453412054696d657374616d70696e67a000318201dc308201d802010130483030310e300c060355040a13056c6f63616c311e301c06035504031315546573742054534120496e7465726d656469617465021461ab8956727edad25ee3c2cd663d5ddd719071a0300b0609608648016503040201a0820126301a06092a864886f70d010903310d060b2a864886f70d0109100104301c06092a864886f70d010905310f170d3234313030323039323135355a302f06092a864886f70d0109043122042089719cf333d5226a661aeab5807edcf53ba01f85323dc0415ee981f6c78d21953081b8060b2a864886f70d010910022f3181a83081a53081a230819f300d060960864801650304020305000440c04d4b48148c29c5cbab7919d432f6b1ae33995426613b4f759631108ff7d1e9c95537fac1acf43e2813754630c29abe6a0e3b804701ef3e04d3a17a4624c910304c3034a4323030310e300c060355040a13056c6f63616c311e301c06035504031315546573742054534120496e7465726d656469617465021461ab8956727edad25ee3c2cd663d5ddd719071a0300a06082a8648ce3d0403020446304402205333cdad93a03d3b22ebc3e84c560e9271fbedef0f97babf71c973a5ce4bd98e022001baf6b000e63eafac813c6e73bd46619bd2a6ebb161ca4e20b5c09a13e118c1") .unwrap(); - let py_bytes = pyo3::types::PyBytes::new_bound(py, &data); + let py_bytes = pyo3::types::PyBytes::new(py, &data); let raw = OwnedTimeStampResp::try_new(py_bytes.into(), |v| { asn1::parse_single::(v.as_bytes(py)) }) diff --git a/rust/src/name.rs b/rust/src/name.rs index efbaa52..0ef1066 100644 --- a/rust/src/name.rs +++ b/rust/src/name.rs @@ -1,11 +1,10 @@ use pyo3::types::IntoPyDict; use pyo3::types::{PyAnyMethods, PyListMethods}; -use pyo3::ToPyObject; -fn parse_name_attribute( - py: pyo3::Python<'_>, +fn parse_name_attribute<'p>( + py: pyo3::Python<'p>, attribute: cryptography_x509::common::AttributeTypeValue<'_>, -) -> pyo3::PyResult { +) -> pyo3::PyResult> { let oid = crate::util::oid_to_py_oid(py, &attribute.type_id)?; let tag_val = attribute.value.tag().as_u8().ok_or_else(|| { pyo3::exceptions::PyValueError::new_err( @@ -15,50 +14,48 @@ fn parse_name_attribute( let py_tag = crate::util::ASN1_TYPE_TO_ENUM.get(py)?.get_item(tag_val)?; let py_data = match attribute.value.tag().as_u8() { // BitString tag value - Some(3) => pyo3::types::PyBytes::new_bound(py, attribute.value.data()).into_any(), + Some(3) => pyo3::types::PyBytes::new(py, attribute.value.data()).into_any(), // BMPString tag value Some(30) => { - let py_bytes = pyo3::types::PyBytes::new_bound(py, attribute.value.data()); + let py_bytes = pyo3::types::PyBytes::new(py, attribute.value.data()); py_bytes.call_method1(pyo3::intern!(py, "decode"), ("utf_16_be",))? } // UniversalString Some(28) => { - let py_bytes = pyo3::types::PyBytes::new_bound(py, attribute.value.data()); + let py_bytes = pyo3::types::PyBytes::new(py, attribute.value.data()); py_bytes.call_method1(pyo3::intern!(py, "decode"), ("utf_32_be",))? } _ => { let parsed = std::str::from_utf8(attribute.value.data()) .map_err(|_| pyo3::exceptions::PyValueError::new_err("Parsing error in ASN1"))?; - pyo3::types::PyString::new_bound(py, parsed).into_any() + pyo3::types::PyString::new(py, parsed).into_any() } }; - let kwargs = [(pyo3::intern!(py, "_validate"), false)].into_py_dict_bound(py); - Ok(crate::util::NAME_ATTRIBUTE - .get(py)? - .call((oid, py_data, py_tag), Some(&kwargs))? - .to_object(py)) + let kwargs = [(pyo3::intern!(py, "_validate"), false)].into_py_dict(py)?; + //.map_err(|_| pyo3::exceptions::PyValueError::new_err("Unable to parse argument"))?; + let o = crate::util::NAME_ATTRIBUTE.get(py)?; + Ok(o.call((oid, py_data, py_tag), Some(&kwargs))?) } pub(crate) fn parse_rdn<'a>( - py: pyo3::Python<'_>, + py: pyo3::Python<'a>, rdn: &asn1::SetOf<'a, cryptography_x509::common::AttributeTypeValue<'a>>, -) -> pyo3::PyResult { - let py_attrs = pyo3::types::PyList::empty_bound(py); +) -> pyo3::PyResult> { + let py_attrs = pyo3::types::PyList::empty(py); for attribute in rdn.clone() { let na = parse_name_attribute(py, attribute)?; py_attrs.append(na)?; } Ok(crate::util::RELATIVE_DISTINGUISHED_NAME .get(py)? - .call1((py_attrs,))? - .to_object(py)) + .call1((py_attrs,))?) } pub(crate) fn parse_name<'p>( py: pyo3::Python<'p>, name: &cryptography_x509::name::NameReadable<'_>, ) -> pyo3::PyResult> { - let py_rdns = pyo3::types::PyList::empty_bound(py); + let py_rdns = pyo3::types::PyList::empty(py); for rdn in name.clone() { let py_rdn = parse_rdn(py, &rdn)?; py_rdns.append(py_rdn)?; @@ -76,14 +73,14 @@ pub(crate) fn parse_general_name( crate::util::OTHER_NAME .get(py)? .call1((oid, data.value.full_data()))? - .to_object(py) + .into() } cryptography_x509::name::GeneralName::DirectoryName(data) => { let py_name = parse_name(py, data.unwrap_read())?; crate::util::DIRECTORY_NAME .get(py)? .call1((py_name,))? - .to_object(py) + .into() } _ => return Err(pyo3::exceptions::PyValueError::new_err("Unknown name form")), }; diff --git a/rust/src/util.rs b/rust/src/util.rs index 3a8e50c..c0de13d 100644 --- a/rust/src/util.rs +++ b/rust/src/util.rs @@ -20,7 +20,7 @@ impl LazyPyImport { pub fn get<'p>(&'p self, py: pyo3::Python<'p>) -> pyo3::PyResult> { let p = self.value.get_or_try_init(py, || { - let mut obj = py.import_bound(self.module)?.into_any(); + let mut obj = py.import(self.module)?.into_any(); for name in self.names { obj = obj.getattr(*name)?; } @@ -35,8 +35,8 @@ pub fn big_byte_slice_to_py_int<'p>( py: pyo3::Python<'p>, v: &'_ [u8], ) -> pyo3::PyResult> { - let int_type = py.get_type_bound::(); - let kwargs = [("signed", true)].into_py_dict_bound(py); + let int_type = py.get_type::(); + let kwargs = [("signed", true)].into_py_dict(py)?; int_type.call_method(pyo3::intern!(py, "from_bytes"), (v, "big"), Some(&kwargs)) } @@ -44,7 +44,7 @@ pub(crate) fn big_asn1_uint_to_py<'p>( py: pyo3::Python<'p>, v: asn1::BigUint<'_>, ) -> pyo3::PyResult> { - let int_type = py.get_type_bound::(); + let int_type = py.get_type::(); Ok(int_type.call_method1( pyo3::intern!(py, "from_bytes"), (v.as_bytes(), pyo3::intern!(py, "big")), @@ -58,7 +58,6 @@ pub(crate) fn oid_to_py_oid<'p>( py: pyo3::Python<'p>, oid: &asn1::ObjectIdentifier, ) -> pyo3::PyResult> { - //Ok(pyo3::Bound::new(py, crate::oid::ObjectIdentifier { oid: oid.clone() })?.into_any()) let oid_object = OBJECT_IDENTIFIER.get(py)?; oid_object.call1((oid.to_string(),)) } diff --git a/rust/tsp-asn1/Cargo.lock b/rust/tsp-asn1/Cargo.lock new file mode 100644 index 0000000..06ba16c --- /dev/null +++ b/rust/tsp-asn1/Cargo.lock @@ -0,0 +1,88 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "asn1" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d97d0d2e60ad0595a73b82264dcd46c2f96769b0f555ae71c14122f0679f65" +dependencies = [ + "asn1_derive", + "itoa", +] + +[[package]] +name = "asn1_derive" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00cec5ab4e9217b82bdd194bf6a4c74890a7e6d530159546bd83684f42211b8a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "cryptography-x509" +version = "0.1.0" +source = "git+https://github.com/pyca/cryptography.git?rev=4c72f368234e60a06e4a0beaf87be55940dd49c1#4c72f368234e60a06e4a0beaf87be55940dd49c1" +dependencies = [ + "asn1", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "proc-macro2" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "syn" +version = "2.0.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tsp-asn1" +version = "0.0.1" +dependencies = [ + "asn1", + "cryptography-x509", + "hex", +] + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" diff --git a/rust/tsp-asn1/Cargo.toml b/rust/tsp-asn1/Cargo.toml index dea06e9..5e735a8 100644 --- a/rust/tsp-asn1/Cargo.toml +++ b/rust/tsp-asn1/Cargo.toml @@ -11,8 +11,8 @@ publish = false name = "tsp_asn1" [dependencies] -asn1 = "0.18" -cryptography-x509 = { git = "https://github.com/pyca/cryptography.git", rev = "a63ca251a7aa8a5aac6153e0b69083cb05e1a6d0" } +asn1 = "0.19" +cryptography-x509 = { git = "https://github.com/pyca/cryptography.git", rev = "4c72f368234e60a06e4a0beaf87be55940dd49c1" } [dev-dependencies] hex = "0.4" \ No newline at end of file