aboutsummaryrefslogtreecommitdiff
path: root/azalea-crypto/src
diff options
context:
space:
mode:
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(())
+ }
+}