diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
commit | 9835e2ae736235810b4ea1c162ca5e65c547e770 (patch) | |
tree | 3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/pasetors/src/version3.rs | |
parent | Releasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff) | |
download | rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip |
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/pasetors/src/version3.rs')
-rw-r--r-- | vendor/pasetors/src/version3.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/vendor/pasetors/src/version3.rs b/vendor/pasetors/src/version3.rs index 5c84a689a..9a2628bc5 100644 --- a/vendor/pasetors/src/version3.rs +++ b/vendor/pasetors/src/version3.rs @@ -77,7 +77,7 @@ impl TryFrom<&AsymmetricSecretKey<V3>> for AsymmetricPublicKey<V3> { type Error = Error; fn try_from(value: &AsymmetricSecretKey<V3>) -> Result<Self, Self::Error> { - let sk = SigningKey::from_bytes(value.as_bytes()).map_err(|_| Error::Key)?; + let sk = SigningKey::from_bytes(value.as_bytes().into()).map_err(|_| Error::Key)?; AsymmetricPublicKey::<V3>::from(sk.verifying_key().to_encoded_point(true).as_bytes()) } } @@ -167,7 +167,8 @@ impl PublicToken { return Err(Error::EmptyPayload); } - let signing_key = SigningKey::from_bytes(secret_key.as_bytes()).map_err(|_| Error::Key)?; + let signing_key = + SigningKey::from_bytes(secret_key.as_bytes().into()).map_err(|_| Error::Key)?; let public_key = VerifyingKey::from(&signing_key).to_encoded_point(true); let f = footer.unwrap_or(&[]); @@ -177,13 +178,13 @@ impl PublicToken { let mut msg_digest = sha2::Sha384::new(); msg_digest.update(m2); - let sig = signing_key + let sig: Signature = signing_key .try_sign_digest(msg_digest) .map_err(|_| Error::Signing)?; - debug_assert_eq!(sig.as_ref().len(), V3::PUBLIC_SIG); + debug_assert_eq!(sig.to_bytes().len(), V3::PUBLIC_SIG); let mut m_sig: Vec<u8> = Vec::from(message); - m_sig.extend_from_slice(sig.as_ref()); + m_sig.extend_from_slice(&sig.to_bytes()); let token_no_footer = format!("{}{}", Self::HEADER, encode_b64(m_sig)?); |