pub struct EcdhTeaCipher { /* private fields */ }Expand description
Compatibility cipher that derives a TEA key from an ECDH shared secret.
Implementations§
Source§impl EcdhTeaCipher
impl EcdhTeaCipher
Sourcepub fn new(server_pubkey_hex: &str) -> Result<Self, CryptoError>
pub fn new(server_pubkey_hex: &str) -> Result<Self, CryptoError>
Creates a cipher from a remote server public key expressed as raw hex.
An empty string keeps encryption disabled for parity with legacy callers.
Sourcepub fn new_with_private_key(
server_pubkey_hex: &str,
private_key: [u8; 32],
) -> Result<Self, CryptoError>
pub fn new_with_private_key( server_pubkey_hex: &str, private_key: [u8; 32], ) -> Result<Self, CryptoError>
Creates a cipher from a caller-supplied private key and server public key.
Sourcepub fn new_with_server_private_key(
client_pubkey: [u8; 64],
server_private_key: [u8; 32],
) -> Result<Self, CryptoError>
pub fn new_with_server_private_key( client_pubkey: [u8; 64], server_private_key: [u8; 32], ) -> Result<Self, CryptoError>
Creates a cipher from a caller-supplied server private key and client public key.
Sourcepub fn client_pubkey(&self) -> [u8; 64]
pub fn client_pubkey(&self) -> [u8; 64]
Returns the client public key sent to the decoder peer.
Sourcepub fn tea_key_words(&self) -> [u32; 4]
pub fn tea_key_words(&self) -> [u32; 4]
Returns the derived TEA key as four little-endian words.
Sourcepub fn encrypt_sync(&self, input: &[u8]) -> Vec<u8> ⓘ
pub fn encrypt_sync(&self, input: &[u8]) -> Vec<u8> ⓘ
C++ sync path currently writes plaintext; keep parity.
Sourcepub fn encrypt_async(&self, input: &[u8]) -> Vec<u8> ⓘ
pub fn encrypt_async(&self, input: &[u8]) -> Vec<u8> ⓘ
Encrypt async chunks block-by-block with TEA and preserve tail bytes.
Sourcepub fn encrypt_async_in_place(&self, input: &mut [u8])
pub fn encrypt_async_in_place(&self, input: &mut [u8])
Encrypts whole 8-byte blocks in place and leaves any trailing bytes unchanged.
Trait Implementations§
Source§impl Clone for EcdhTeaCipher
impl Clone for EcdhTeaCipher
Source§impl Debug for EcdhTeaCipher
impl Debug for EcdhTeaCipher
Auto Trait Implementations§
impl Freeze for EcdhTeaCipher
impl RefUnwindSafe for EcdhTeaCipher
impl Send for EcdhTeaCipher
impl Sync for EcdhTeaCipher
impl Unpin for EcdhTeaCipher
impl UnsafeUnpin for EcdhTeaCipher
impl UnwindSafe for EcdhTeaCipher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more