aboutsummaryrefslogtreecommitdiff
path: root/azalea-crypto/src
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-06-23 15:12:17 -0500
committermat <github@matdoes.dev>2022-06-23 15:12:17 -0500
commit5ca49e680ed8519456dc9a9af84321d4b69dcbb3 (patch)
tree0f727c3e862f60eb227db69c87946a0f629a397d /azalea-crypto/src
parentc7b0c51274b5d8548c8a2f829b75dfbec4038be2 (diff)
downloadazalea-drasl-5ca49e680ed8519456dc9a9af84321d4b69dcbb3.tar.xz
azalea-buf
Diffstat (limited to 'azalea-crypto/src')
-rw-r--r--azalea-crypto/src/lib.rs2
-rw-r--r--azalea-crypto/src/signing.rs16
2 files changed, 18 insertions, 0 deletions
diff --git a/azalea-crypto/src/lib.rs b/azalea-crypto/src/lib.rs
index a5e797e8..85705883 100644
--- a/azalea-crypto/src/lib.rs
+++ b/azalea-crypto/src/lib.rs
@@ -79,6 +79,8 @@ pub fn decrypt_packet(cipher: &mut Aes128CfbDec, packet: &mut [u8]) {
cipher.decrypt_blocks_inout_mut(chunks);
}
+
+
#[cfg(test)]
mod tests {
use super::*;
diff --git a/azalea-crypto/src/signing.rs b/azalea-crypto/src/signing.rs
index 21cd813a..a5280a18 100644
--- a/azalea-crypto/src/signing.rs
+++ b/azalea-crypto/src/signing.rs
@@ -3,3 +3,19 @@ pub struct SaltSignaturePair {
pub salt: u64,
pub signature: Vec<u8>,
}
+
+impl McBufReadable for SaltSignaturePair {
+ fn read_into(buf: &mut impl Read) -> Result<Self, String> {
+ let salt = u64::read_into(buf)?;
+ let signature = Vec::<u8>::read_into(buf)?;
+ Ok(SaltSignaturePair { salt, signature })
+ }
+}
+
+impl McBufWritable for SaltSignaturePair {
+ fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
+ self.salt.write_into(buf)?;
+ self.signature.write_into(buf)?;
+ Ok(())
+ }
+}