Package com.wire.cryptobox
Class CryptoSession
- java.lang.Object
-
- com.wire.cryptobox.CryptoSession
-
public final class CryptoSession extends java.lang.ObjectA CryptoSession represents a cryptographic session with a peer (e.g. client or device) and is used to encrypt and decrypt messages sent and received, respectively.A CryptoSession is thread-safe.
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.Stringid
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]decrypt(byte[] ciphertext)Decrypt a byte array containing ciphertext.byte[]encrypt(byte[] plaintext)Encrypt a byte array containing plaintext.byte[]getRemoteFingerprint()Get the remote fingerprint as a hex-encoded byte array.booleanisClosed()voidsave()Save the session, persisting any changes made to the underlying key material as a result of anyencrypt(byte[])anddecrypt(byte[])operations since the last save.
-
-
-
Method Detail
-
save
public void save() throws CryptoExceptionSave the session, persisting any changes made to the underlying key material as a result of anyencrypt(byte[])anddecrypt(byte[])operations since the last save.- Throws:
CryptoException
-
encrypt
public byte[] encrypt(byte[] plaintext) throws CryptoExceptionEncrypt a byte array containing plaintext.- Parameters:
plaintext- The plaintext to encrypt.- Returns:
- A byte array containing the ciphertext.
- Throws:
CryptoException
-
decrypt
public byte[] decrypt(byte[] ciphertext) throws CryptoExceptionDecrypt a byte array containing ciphertext.- Parameters:
ciphertext- The ciphertext to decrypt.- Returns:
- A byte array containing the plaintext.
- Throws:
CryptoException
-
getRemoteFingerprint
public byte[] getRemoteFingerprint() throws CryptoExceptionGet the remote fingerprint as a hex-encoded byte array.- Throws:
CryptoException
-
isClosed
public boolean isClosed()
-
-