Loading crates/tor-cert/README.md +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ let cert_bin = base64::decode(cert_base64).unwrap(); // Decode the cert and check its signature. let cert = Ed25519Cert::decode(&cert_bin).unwrap() .check_key(&None).unwrap() .check_key(None).unwrap() .check_signature().unwrap() .dangerously_assume_timely(); let signed_key = cert.subject_key(); Loading crates/tor-cert/semver.md 0 → 100644 +1 −0 Original line number Diff line number Diff line BREAKING: `Ed25519Cert::check_key` prototype changed from taking `&Option<ed25519::PublicKey>` to `Option<&ed25519::PublicKey>` crates/tor-cert/src/encode.rs +1 −1 Original line number Diff line number Diff line Loading @@ -179,7 +179,7 @@ mod test { let decoded = Ed25519Cert::decode(&encoded).unwrap(); // Well-formed? let validated = decoded .check_key(&Some(keypair.public)) .check_key(Some(&keypair.public)) .unwrap() .check_signature() .unwrap(); // Well-signed? Loading crates/tor-cert/src/lib.rs +2 −2 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ //! //! // Decode the cert and check its signature. //! let cert = Ed25519Cert::decode(&cert_bin).unwrap() //! .check_key(&None).unwrap() //! .check_key(None).unwrap() //! .check_signature().unwrap() //! .dangerously_assume_timely(); //! let signed_key = cert.subject_key(); Loading Loading @@ -465,7 +465,7 @@ impl KeyUnknownCert { /// /// On success, we can check whether the certificate is well-signed; /// otherwise, we can't check the certificate. pub fn check_key(self, pkey: &Option<ed25519::PublicKey>) -> CertResult<UncheckedCert> { pub fn check_key(self, pkey: Option<&ed25519::PublicKey>) -> CertResult<UncheckedCert> { let real_key = match (pkey, self.cert.cert.signed_with) { (Some(a), Some(b)) if a == &b => b, (Some(_), Some(_)) => return Err(CertError::KeyMismatch), Loading crates/tor-cert/tests/invalid_certs.rs +2 −2 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ fn mismatched_signing_key() { // We give the wrong key to check_key, so it will tell us that // wasn't what the cert contained. assert_eq!( cert.check_key(&Some(not_that_key)).err().unwrap(), cert.check_key(Some(¬_that_key)).err().unwrap(), CertError::KeyMismatch ); Loading @@ -86,7 +86,7 @@ fn mismatched_signing_key() { // We give no key to check_key, which will tell us that there wasn't // a signing-key extension in the cert. assert_eq!( cert.check_key(&None).err().unwrap(), cert.check_key(None).err().unwrap(), CertError::MissingPubKey ); } Loading
crates/tor-cert/README.md +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ let cert_bin = base64::decode(cert_base64).unwrap(); // Decode the cert and check its signature. let cert = Ed25519Cert::decode(&cert_bin).unwrap() .check_key(&None).unwrap() .check_key(None).unwrap() .check_signature().unwrap() .dangerously_assume_timely(); let signed_key = cert.subject_key(); Loading
crates/tor-cert/semver.md 0 → 100644 +1 −0 Original line number Diff line number Diff line BREAKING: `Ed25519Cert::check_key` prototype changed from taking `&Option<ed25519::PublicKey>` to `Option<&ed25519::PublicKey>`
crates/tor-cert/src/encode.rs +1 −1 Original line number Diff line number Diff line Loading @@ -179,7 +179,7 @@ mod test { let decoded = Ed25519Cert::decode(&encoded).unwrap(); // Well-formed? let validated = decoded .check_key(&Some(keypair.public)) .check_key(Some(&keypair.public)) .unwrap() .check_signature() .unwrap(); // Well-signed? Loading
crates/tor-cert/src/lib.rs +2 −2 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ //! //! // Decode the cert and check its signature. //! let cert = Ed25519Cert::decode(&cert_bin).unwrap() //! .check_key(&None).unwrap() //! .check_key(None).unwrap() //! .check_signature().unwrap() //! .dangerously_assume_timely(); //! let signed_key = cert.subject_key(); Loading Loading @@ -465,7 +465,7 @@ impl KeyUnknownCert { /// /// On success, we can check whether the certificate is well-signed; /// otherwise, we can't check the certificate. pub fn check_key(self, pkey: &Option<ed25519::PublicKey>) -> CertResult<UncheckedCert> { pub fn check_key(self, pkey: Option<&ed25519::PublicKey>) -> CertResult<UncheckedCert> { let real_key = match (pkey, self.cert.cert.signed_with) { (Some(a), Some(b)) if a == &b => b, (Some(_), Some(_)) => return Err(CertError::KeyMismatch), Loading
crates/tor-cert/tests/invalid_certs.rs +2 −2 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ fn mismatched_signing_key() { // We give the wrong key to check_key, so it will tell us that // wasn't what the cert contained. assert_eq!( cert.check_key(&Some(not_that_key)).err().unwrap(), cert.check_key(Some(¬_that_key)).err().unwrap(), CertError::KeyMismatch ); Loading @@ -86,7 +86,7 @@ fn mismatched_signing_key() { // We give no key to check_key, which will tell us that there wasn't // a signing-key extension in the cert. assert_eq!( cert.check_key(&None).err().unwrap(), cert.check_key(None).err().unwrap(), CertError::MissingPubKey ); }