public class WrappedRawMaterials extends AbstractRawMaterials
Other possibly implementations might use a Key-Derivation Function to derive a unique key per record.
| Modifier and Type | Field and Description |
|---|---|
static String |
CONTENT_KEY_ALGORITHM
The key-name in the Description which contains the algorithm used by the content key.
|
static String |
ENVELOPE_KEY
The key-name in the Description which which contains the wrapped content key.
|
static String |
KEY_WRAPPING_ALGORITHM
The key-name in the Description which contains the algorithm use to wrap content key.
|
protected Key |
unwrappingKey |
protected Key |
wrappingKey |
| Constructor and Description |
|---|
WrappedRawMaterials(Key wrappingKey,
Key unwrappingKey,
KeyPair signingPair) |
WrappedRawMaterials(Key wrappingKey,
Key unwrappingKey,
KeyPair signingPair,
Map<String,String> description) |
WrappedRawMaterials(Key wrappingKey,
Key unwrappingKey,
SecretKey macKey) |
WrappedRawMaterials(Key wrappingKey,
Key unwrappingKey,
SecretKey macKey,
Map<String,String> description) |
| Modifier and Type | Method and Description |
|---|---|
protected SecretKey |
generateContentKey(String algorithm) |
SecretKey |
getDecryptionKey() |
SecretKey |
getEncryptionKey() |
protected SecretKey |
initEnvelopeKey()
Called by the constructors.
|
protected SecretKey |
unwrapKey(Map<String,String> description,
byte[] encryptedKey,
String wrappingAlgorithm) |
byte[] |
wrapKey(SecretKey key,
String wrappingAlg) |
getMaterialDescription, getSigningKey, getVerificationKey, setMaterialDescriptionpublic static final String KEY_WRAPPING_ALGORITHM
public static final String CONTENT_KEY_ALGORITHM
public static final String ENVELOPE_KEY
protected final Key wrappingKey
protected final Key unwrappingKey
public WrappedRawMaterials(Key wrappingKey, Key unwrappingKey, KeyPair signingPair) throws GeneralSecurityException
GeneralSecurityExceptionpublic WrappedRawMaterials(Key wrappingKey, Key unwrappingKey, KeyPair signingPair, Map<String,String> description) throws GeneralSecurityException
GeneralSecurityExceptionpublic WrappedRawMaterials(Key wrappingKey, Key unwrappingKey, SecretKey macKey) throws GeneralSecurityException
GeneralSecurityExceptionpublic WrappedRawMaterials(Key wrappingKey, Key unwrappingKey, SecretKey macKey, Map<String,String> description) throws GeneralSecurityException
GeneralSecurityExceptionpublic SecretKey getDecryptionKey()
public SecretKey getEncryptionKey()
protected SecretKey initEnvelopeKey() throws GeneralSecurityException
ENVELOPE_KEY) it extracts it
and returns it. Otherwise it generates a new key, stores a wrapped version in the Description,
and returns the key to the caller.getDecryptionKey() and getEncryptionKey().GeneralSecurityExceptionpublic byte[] wrapKey(SecretKey key, String wrappingAlg) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException
protected SecretKey unwrapKey(Map<String,String> description, byte[] encryptedKey, String wrappingAlgorithm) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException
protected SecretKey generateContentKey(String algorithm) throws NoSuchAlgorithmException
NoSuchAlgorithmExceptionCopyright © 2021. All rights reserved.