public final class SivMode extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
SivMode.BlockCipherFactory
Creates
BlockCiphers. |
| Constructor and Description |
|---|
SivMode()
Creates an AES-SIV instance using JCE's cipher implementation, which should normally be the best choice.
For embedded systems, you might want to consider using SivMode(BlockCipherFactory) with AESLightEngine instead. |
SivMode(SivMode.BlockCipherFactory cipherFactory)
Creates an instance using a specific Blockcipher.get().
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
decrypt(byte[] ctrKey,
byte[] macKey,
byte[] ciphertext,
byte[]... associatedData)
Decrypts ciphertext using SIV mode.
|
byte[] |
decrypt(SecretKey ctrKey,
SecretKey macKey,
byte[] ciphertext,
byte[]... associatedData)
Convenience method, if you are using the javax.crypto API.
|
byte[] |
encrypt(byte[] ctrKey,
byte[] macKey,
byte[] plaintext,
byte[]... associatedData)
Encrypts plaintext using SIV mode.
|
byte[] |
encrypt(SecretKey ctrKey,
SecretKey macKey,
byte[] plaintext,
byte[]... associatedData)
Convenience method, if you are using the javax.crypto API.
|
public SivMode()
SivMode(BlockCipherFactory) with AESLightEngine instead.SivMode(BlockCipherFactory)public SivMode(SivMode.BlockCipherFactory cipherFactory)
cipherFactory - A factory method creating a Blockcipher.get(). Must use a block size of 128 bits (16 bytes).public byte[] encrypt(SecretKey ctrKey, SecretKey macKey, byte[] plaintext, byte[]... associatedData)
#encrypt(byte[], byte[], byte[], byte[]...).ctrKey - SIV mode requires two separate keys. You can use one long key, which is splitted in half. See https://tools.ietf.org/html/rfc5297#section-2.2macKey - SIV mode requires two separate keys. You can use one long key, which is splitted in half. See https://tools.ietf.org/html/rfc5297#section-2.2plaintext - Your plaintext, which shall be encrypted.associatedData - Optional associated data, which gets authenticated but not encrypted.IllegalArgumentException - if keys are invalid or Key.getEncoded() is not supported.public byte[] encrypt(byte[] ctrKey,
byte[] macKey,
byte[] plaintext,
byte[]... associatedData)
ctrKey - SIV mode requires two separate keys. You can use one long key, which is splitted in half. See https://tools.ietf.org/html/rfc5297#section-2.2macKey - SIV mode requires two separate keys. You can use one long key, which is splitted in half. See https://tools.ietf.org/html/rfc5297#section-2.2plaintext - Your plaintext, which shall be encrypted.associatedData - Optional associated data, which gets authenticated but not encrypted.IllegalArgumentException - if the either of the two keys is of invalid length for the used BlockCipher.public byte[] decrypt(SecretKey ctrKey, SecretKey macKey, byte[] ciphertext, byte[]... associatedData) throws AEADBadTagException, IllegalBlockSizeException
#decrypt(byte[], byte[], byte[], byte[]...).ctrKey - SIV mode requires two separate keys. You can use one long key, which is splitted in half. See https://tools.ietf.org/html/rfc5297#section-2.2macKey - SIV mode requires two separate keys. You can use one long key, which is splitted in half. See https://tools.ietf.org/html/rfc5297#section-2.2ciphertext - Your cipehrtext, which shall be decrypted.associatedData - Optional associated data, which needs to be authenticated during decryption.IllegalArgumentException - If keys are invalid or Key.getEncoded() is not supported.AEADBadTagException - If the authentication failed, e.g. because ciphertext and/or associatedData are corrupted.IllegalBlockSizeException - If the provided ciphertext is of invalid length.public byte[] decrypt(byte[] ctrKey,
byte[] macKey,
byte[] ciphertext,
byte[]... associatedData)
throws AEADBadTagException,
IllegalBlockSizeException
ctrKey - SIV mode requires two separate keys. You can use one long key, which is splitted in half. See https://tools.ietf.org/html/rfc5297#section-2.2macKey - SIV mode requires two separate keys. You can use one long key, which is splitted in half. See https://tools.ietf.org/html/rfc5297#section-2.2ciphertext - Your ciphertext, which shall be encrypted.associatedData - Optional associated data, which needs to be authenticated during decryption.IllegalArgumentException - If the either of the two keys is of invalid length for the used BlockCipher.AEADBadTagException - If the authentication failed, e.g. because ciphertext and/or associatedData are corrupted.IllegalBlockSizeException - If the provided ciphertext is of invalid length.Copyright © 2016. All rights reserved.