summaryrefslogtreecommitdiffstats
path: root/vendor/pasetors/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:42 +0000
commit837b550238aa671a591ccf282dddeab29cadb206 (patch)
tree914b6b8862bace72bd3245ca184d374b08d8a672 /vendor/pasetors/src
parentAdding debian version 1.70.0+dfsg2-1. (diff)
downloadrustc-837b550238aa671a591ccf282dddeab29cadb206.tar.xz
rustc-837b550238aa671a591ccf282dddeab29cadb206.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/pasetors/src')
-rw-r--r--vendor/pasetors/src/lib.rs2
-rw-r--r--vendor/pasetors/src/pae.rs12
-rw-r--r--vendor/pasetors/src/version3.rs11
3 files changed, 13 insertions, 12 deletions
diff --git a/vendor/pasetors/src/lib.rs b/vendor/pasetors/src/lib.rs
index a921e9272..6b58b8378 100644
--- a/vendor/pasetors/src/lib.rs
+++ b/vendor/pasetors/src/lib.rs
@@ -183,7 +183,7 @@
unused_qualifications,
overflowing_literals
)]
-#![doc(html_root_url = "https://docs.rs/pasetors/0.6.5")]
+#![doc(html_root_url = "https://docs.rs/pasetors/0.6.6")]
#![cfg_attr(docsrs, feature(doc_cfg))]
#[macro_use]
diff --git a/vendor/pasetors/src/pae.rs b/vendor/pasetors/src/pae.rs
index e72e849b0..7bb7746c7 100644
--- a/vendor/pasetors/src/pae.rs
+++ b/vendor/pasetors/src/pae.rs
@@ -53,26 +53,26 @@ mod unit_tests {
#[test]
fn test_pae() {
// Source: https://github.com/paragonie/paseto/blob/master/tests/UtilTest.php
- assert_eq!("0000000000000000", hex::encode(&pae(&[]).unwrap()));
+ assert_eq!("0000000000000000", hex::encode(pae(&[]).unwrap()));
assert_eq!(
"01000000000000000000000000000000",
- hex::encode(&pae(&[b""]).unwrap())
+ hex::encode(pae(&[b""]).unwrap())
);
assert_eq!(
"020000000000000000000000000000000000000000000000",
- hex::encode(&pae(&[b"", b""]).unwrap())
+ hex::encode(pae(&[b"", b""]).unwrap())
);
assert_eq!(
"0100000000000000070000000000000050617261676f6e",
- hex::encode(&pae(&[b"Paragon"]).unwrap())
+ hex::encode(pae(&[b"Paragon"]).unwrap())
);
assert_eq!(
"0200000000000000070000000000000050617261676f6e0a00000000000000496e6974696174697665",
- hex::encode(&pae(&[b"Paragon", b"Initiative",]).unwrap())
+ hex::encode(pae(&[b"Paragon", b"Initiative",]).unwrap())
);
assert_eq!(
"0100000000000000190000000000000050617261676f6e0a00000000000000496e6974696174697665",
- hex::encode(&pae(&[b"Paragon\n\0\0\0\0\0\0\0Initiative"]).unwrap())
+ hex::encode(pae(&[b"Paragon\n\0\0\0\0\0\0\0Initiative"]).unwrap())
);
}
}
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)?);