diff --git a/Cargo.lock b/Cargo.lock index ce4cc87..87fb515 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -281,7 +281,7 @@ dependencies = [ [[package]] name = "rsmime" -version = "0.3.0" +version = "0.3.1" dependencies = [ "openssl", "pyo3", diff --git a/Cargo.toml b/Cargo.toml index 17cae98..2008ef5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rsmime" -version = "0.3.0" +version = "0.3.1" edition = "2021" [lib] diff --git a/pyproject.toml b/pyproject.toml index 8785fbf..85dc79f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "maturin" [project] name = "rsmime" -version = "0.3.0" +version = "0.3.1" classifiers = [ "License :: OSI Approved :: MIT License", "Development Status :: 3 - Alpha", diff --git a/rsmime.pyi b/rsmime.pyi index f50dc70..a5c742a 100644 --- a/rsmime.pyi +++ b/rsmime.pyi @@ -1,2 +1,11 @@ +class ReadCertificateError(Exception): + ... + +class LoadCertificateError(Exception): + ... + +class SignError(Exception): + ... + def sign(cert_file: str, key_file: str, data_to_sign: bytes) -> str: ... \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 088321d..cf7e4ff 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,13 +37,8 @@ pub fn _sign(cert_file: &str, key_file: &str, data_to_sign: &[u8]) -> PyResult) -> PyResult { match _sign(cert_file, key_file, &data_to_sign) { - Ok(signed_data) => { - match String::from_utf8(signed_data) { - Ok(signed_string) => Ok(signed_string), - Err(err) => Err(PyException::new_err(err)) - } - }, - Err(err) => Err(PyException::new_err(err.to_string())), + Ok(signed_data) => Ok(String::from_utf8(signed_data).expect("Failed to convert to string")), + Err(err) => Err(err), } }