Package org.signal.libsignal.protocol
Class SessionCipher
-
- All Implemented Interfaces:
public class SessionCipherThe main entry point for Signal Protocol encrypt/decrypt operations.
Once a session has been established with SessionBuilder, this class can be used for all encrypt/decrypt operations within that session.
This class is not thread-safe.
Moxie Marlinspike
-
-
Constructor Summary
Constructors Constructor Description SessionCipher(SessionStore sessionStore, PreKeyStore preKeyStore, SignedPreKeyStore signedPreKeyStore, KyberPreKeyStore kyberPreKeyStore, IdentityKeyStore identityKeyStore, SignalProtocolAddress remoteAddress)Construct a SessionCipher for encrypt/decrypt operations on a session. SessionCipher(SignalProtocolStore store, SignalProtocolAddress remoteAddress)
-
Method Summary
Modifier and Type Method Description CiphertextMessageencrypt(Array<byte> paddedMessage)Encrypt a message. CiphertextMessageencrypt(Array<byte> paddedMessage, Instant now)Encrypt a message. Array<byte>decrypt(PreKeySignalMessage ciphertext, UsePqRatchet usePqRatchet)Decrypt a message. Array<byte>decrypt(SignalMessage ciphertext)Decrypt a message. intgetRemoteRegistrationId()intgetSessionVersion()-
-
Constructor Detail
-
SessionCipher
SessionCipher(SessionStore sessionStore, PreKeyStore preKeyStore, SignedPreKeyStore signedPreKeyStore, KyberPreKeyStore kyberPreKeyStore, IdentityKeyStore identityKeyStore, SignalProtocolAddress remoteAddress)
Construct a SessionCipher for encrypt/decrypt operations on a session.- Parameters:
sessionStore- The SessionStore that contains a session for this recipient.remoteAddress- The remote address that messages will be encrypted to or decrypted from.
-
SessionCipher
SessionCipher(SignalProtocolStore store, SignalProtocolAddress remoteAddress)
-
-
Method Detail
-
encrypt
CiphertextMessage encrypt(Array<byte> paddedMessage)
Encrypt a message.
- Parameters:
paddedMessage- The plaintext message bytes, optionally padded to a constant multiple.- Returns:
A ciphertext message encrypted to the recipient+device tuple.
-
encrypt
CiphertextMessage encrypt(Array<byte> paddedMessage, Instant now)
Encrypt a message.
You should only use this overload if you need to test session expiration explicitly.
- Parameters:
paddedMessage- The plaintext message bytes, optionally padded to a constant multiple.- Returns:
A ciphertext message encrypted to the recipient+device tuple.
-
decrypt
Array<byte> decrypt(PreKeySignalMessage ciphertext, UsePqRatchet usePqRatchet)
Decrypt a message.
- Parameters:
ciphertext- The PreKeySignalMessage to decrypt.- Returns:
The plaintext.
-
decrypt
Array<byte> decrypt(SignalMessage ciphertext)
Decrypt a message.
- Parameters:
ciphertext- The SignalMessage to decrypt.- Returns:
The plaintext.
-
getRemoteRegistrationId
int getRemoteRegistrationId()
-
getSessionVersion
int getSessionVersion()
-
-
-
-