public class StreamingGCMAES
extends java.lang.Object
For difference between this and StreamingGCMAESPacketMode, see the latter's documentation.
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
initialVector |
| Constructor and Description |
|---|
StreamingGCMAES() |
StreamingGCMAES(int keyLength) |
StreamingGCMAES(org.cryptimeleon.math.serialization.Representation repr) |
| Modifier and Type | Method and Description |
|---|---|
java.io.OutputStream |
createDecryptor(java.io.OutputStream out,
DecryptionKey privateKey)
Returns an OutputStream that decrypts any bytes written to it
and writes the resulting plaintext to out.
|
java.io.OutputStream |
createEncryptor(java.io.OutputStream out,
EncryptionKey publicKey)
Returns an OutputStream that encrypts any bytes written to it
and writes the resulting ciphertext to out.
|
PlainText |
decrypt(CipherText cipherText,
DecryptionKey privateKey)
Decrypts the given cipher text using the given decryption key.
|
java.io.InputStream |
decrypt(java.io.InputStream in,
DecryptionKey privateKey)
Returns an InputStream containing the plaintext obtained
by decrypting the content of in.
|
void |
decrypt(java.io.InputStream cipherTextIn,
java.io.OutputStream plainTextOut,
DecryptionKey privateKey)
Reads and decrypts a ciphertext from cipherTextIn and writes
the resulting plaintext bytes to plainTextOut.
|
java.io.InputStream |
encrypt(java.io.InputStream in,
EncryptionKey publicKey)
Returns an InputStream containing the ciphertext obtained
by encrypting the content of in.
|
void |
encrypt(java.io.InputStream plainTextIn,
java.io.OutputStream cipherTextOut,
EncryptionKey publicKey)
Reads and encrypts the bytes from plainTextIn and writes
the ciphertext to cipherTextOut.
|
CipherText |
encrypt(PlainText plainText,
EncryptionKey publicKey)
Encrypts the given plain text using the given encryption key.
|
boolean |
equals(java.lang.Object obj) |
SymmetricKey |
generateSymmetricKey()
Generates a symmetric key, which is a random key with a specified length.
|
org.cryptimeleon.math.serialization.Representation |
getRepresentation() |
int |
hashCode() |
void |
initCipher(javax.crypto.Cipher cipher,
ByteArrayImplementation symmetricKey,
int mode) |
CipherText |
restoreCipherText(org.cryptimeleon.math.serialization.Representation repr)
Restores the ciphertext corresponding to the given representation.
|
DecryptionKey |
restoreDecryptionKey(org.cryptimeleon.math.serialization.Representation repr)
Restores the decryption key corresponding to the given representation.
|
EncryptionKey |
restoreEncryptionKey(org.cryptimeleon.math.serialization.Representation repr)
Restores the encryption key corresponding to the given representation.
|
PlainText |
restorePlainText(org.cryptimeleon.math.serialization.Representation repr)
Restores the plaintext corresponding to the given representation.
|
protected static ByteArrayImplementation |
updateKeyToLength(ByteArrayImplementation symmetricKey,
int symmetricKeyLength) |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitdecrypt, encrypt, restoreFromRepresentationpublic StreamingGCMAES()
public StreamingGCMAES(int keyLength)
public StreamingGCMAES(org.cryptimeleon.math.serialization.Representation repr)
public void initCipher(javax.crypto.Cipher cipher,
ByteArrayImplementation symmetricKey,
int mode)
throws java.security.InvalidAlgorithmParameterException,
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterExceptionjava.security.InvalidKeyExceptionpublic java.io.InputStream encrypt(java.io.InputStream in,
EncryptionKey publicKey)
throws java.io.IOException
StreamingEncryptionSchemeNote that calling this may already cause some bytes to be read from in.
encrypt in interface StreamingEncryptionSchemein - stream containing the bytes to encryptpublicKey - the key to encrypt withjava.io.IOExceptionpublic java.io.InputStream decrypt(java.io.InputStream in,
DecryptionKey privateKey)
throws java.io.IOException
StreamingEncryptionSchemeNote that calling this may already cause some bytes to be read from in.
decrypt in interface StreamingEncryptionSchemein - in stream containing the bytes to decryptprivateKey - the key to decrypt with.java.io.IOExceptionprotected static ByteArrayImplementation updateKeyToLength(ByteArrayImplementation symmetricKey, int symmetricKeyLength)
public java.io.OutputStream createEncryptor(java.io.OutputStream out,
EncryptionKey publicKey)
throws java.io.IOException
StreamingEncryptionSchemeNote that calling this may already cause some bytes to be written to out.
createEncryptor in interface StreamingEncryptionSchemeout - the stream to write the ciphertext to.publicKey - the key to encrypt with.java.io.IOExceptionpublic java.io.OutputStream createDecryptor(java.io.OutputStream out,
DecryptionKey privateKey)
throws java.io.IOException
StreamingEncryptionSchemeNote that calling this may already cause some bytes to be written to out.
createDecryptor in interface StreamingEncryptionSchemeout - the stream to write the plaintext to.privateKey - the key to decrypt with.java.io.IOExceptionpublic void encrypt(java.io.InputStream plainTextIn,
java.io.OutputStream cipherTextOut,
EncryptionKey publicKey)
throws java.io.IOException
StreamingEncryptionSchemeencrypt in interface StreamingEncryptionSchemejava.io.IOException - if any of the streams throw an exception while reading/writing bytes.public void decrypt(java.io.InputStream cipherTextIn,
java.io.OutputStream plainTextOut,
DecryptionKey privateKey)
throws java.io.IOException
StreamingEncryptionSchemedecrypt in interface StreamingEncryptionSchemejava.io.IOException - if any of the streams throw an exception while reading/writing bytes.public CipherText encrypt(PlainText plainText, EncryptionKey publicKey)
EncryptionSchemeencrypt in interface EncryptionSchemeplainText - the plaintext to encryptpublicKey - the key to use for encryptionpublic PlainText decrypt(CipherText cipherText, DecryptionKey privateKey)
EncryptionSchemedecrypt in interface EncryptionSchemecipherText - the ciphertext to decryptprivateKey - the key to use for decryptionpublic SymmetricKey generateSymmetricKey()
public CipherText restoreCipherText(org.cryptimeleon.math.serialization.Representation repr)
EncryptionSchemerestoreCipherText in interface EncryptionSchemerepr - the representation to restore the ciphertext frompublic DecryptionKey restoreDecryptionKey(org.cryptimeleon.math.serialization.Representation repr)
EncryptionSchemerestoreDecryptionKey in interface EncryptionSchemerepr - the representation to restore the decryption key frompublic EncryptionKey restoreEncryptionKey(org.cryptimeleon.math.serialization.Representation repr)
EncryptionSchemerestoreEncryptionKey in interface EncryptionSchemerepr - the representation to restore the encryption key frompublic PlainText restorePlainText(org.cryptimeleon.math.serialization.Representation repr)
EncryptionSchemerestorePlainText in interface EncryptionSchemerepr - the representation to restore the plaintext frompublic org.cryptimeleon.math.serialization.Representation getRepresentation()
getRepresentation in interface org.cryptimeleon.math.serialization.Representablepublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object