Skip to content

Commit

Permalink
update ed25519 library
Browse files Browse the repository at this point in the history
  • Loading branch information
TheEnbyperor committed Oct 13, 2023
1 parent 9986f6b commit f8127a0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "certbot-onion"
version = "0.1.6"
version = "0.1.7"
description = "Certbot authenticator plugin for the onion-csr-01 challenge"
authors = [
{name = "Q Misell", email = "[email protected]"}
Expand All @@ -13,7 +13,7 @@ readme = "README.md"

[project.urls]
"Homepage" = "https://acmeforonions.org"
"Bug Tracker" = "https://github.com/AS207960/certbot-onion"
"Repository" = "https://github.com/AS207960/certbot-onion"

[build-system]
requires = ["setuptools", "wheel", "setuptools-rust"]
Expand Down
9 changes: 5 additions & 4 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ authors = ["Q Misell <[email protected]>"]
edition = "2021"

[dependencies]
pyo3 = { version = "0.18", features = ["extension-module"] }
ed25519-dalek = "1"
pyo3 = { version = "0.20", features = ["extension-module"] }
ed25519-dalek = { version = "2", features = ["hazmat"] }
hex = "0.4"
openssl = { version = ">=0.10.25", features = ["vendored", "v111"] }
openssl-sys = "0.9"
rand = "0.8"
libc = "0.2"
foreign-types-shared = "0.1"
asn1 = "0.14"
asn1 = "0.15"
sha2 = "0.10.8"

[lib]
name = "certbot_onion_rust"
crate-type = ["cdylib"]
crate-type = ["cdylib"]
6 changes: 3 additions & 3 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ fn _rust(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
fn make_csr(priv_key: &[u8], ca_nonce: &[u8]) -> PyResult<Vec<u8>> {
let mut rng = rand::thread_rng();

let sk = ed25519_dalek::ExpandedSecretKey::from_bytes(priv_key)
let sk = ed25519_dalek::hazmat::ExpandedSecretKey::from_slice(priv_key)
.map_err(|e| PyErr::new::<pyo3::exceptions::PyValueError, _>(e.to_string()))?;
let pk = ed25519_dalek::PublicKey::from(&sk);
let pk = ed25519_dalek::VerifyingKey::from(&sk);
let openssl_pk = openssl::pkey::PKey::public_key_from_raw_bytes(
pk.as_bytes(), openssl::pkey::Id::ED25519
).unwrap();
Expand Down Expand Up @@ -49,7 +49,7 @@ fn make_csr(priv_key: &[u8], ca_nonce: &[u8]) -> PyResult<Vec<u8>> {
buf
};

let signature = sk.sign(&tbs_req, &pk).to_bytes();
let signature = ed25519_dalek::hazmat::raw_sign::<sha2::Sha512>(&sk, &tbs_req, &pk).to_bytes();

let tbs_req: asn1::Sequence = asn1::parse_single(&tbs_req).unwrap();

Expand Down

0 comments on commit f8127a0

Please sign in to comment.