Package com.emc.object
Class EncryptionConfig
- java.lang.Object
-
- com.emc.object.EncryptionConfig
-
public class EncryptionConfig extends java.lang.Object
Creates an encryption configuration for use withS3EncryptionClient
. Both keystore keys and bare RSA KeyPairs are supported. You can optionally implement your ownKeyProvider
as well.
-
-
Constructor Summary
Constructors Constructor Description EncryptionConfig(com.emc.codec.encryption.KeyProvider keyProvider)
EncryptionConfig(EncryptionConfig other)
Cloning constructor.EncryptionConfig(java.security.KeyPair masterEncryptionKey, java.util.Set<java.security.KeyPair> decryptionKeys)
Creates a new EncryptionConfig object that uses bare KeyPair objects.EncryptionConfig(java.security.KeyStore keystore, char[] masterKeyPassword, java.lang.String masterKeyAlias)
Creates a new EncryptionConfig object that will retrieve keys from a Keystore object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.Object>
getCodecProperties()
java.lang.String
getCompressionSpec()
java.lang.String
getEncryptionSpec()
com.emc.codec.encryption.KeyProvider
getKeyProvider()
int
getKeySize()
java.security.Provider
getSecurityProvider()
boolean
isCompressionEnabled()
void
setCodecProperties(java.util.Map<java.lang.String,java.lang.Object> codecProperties)
void
setCompressionEnabled(boolean compressionEnabled)
If set to true, will enable compression for objects created with the encryption client.void
setCompressionSpec(java.lang.String compressionSpec)
Sets the compression spec to use for compression.void
setEncryptionSpec(java.lang.String encryptionSpec)
void
setKeySize(int keySize)
Set the size of encryption key to use, either 128 or 256.void
setSecurityProvider(java.security.Provider provider)
Set the Java security provider to use for all encryption operations.EncryptionConfig
withCompressionEnabled(boolean compressionEnabled)
EncryptionConfig
withCompressionSpec(java.lang.String compressionSpec)
EncryptionConfig
withEncryptionSpec(java.lang.String encryptionSpec)
EncryptionConfig
withKeySize(int keySize)
EncryptionConfig
withSecurityProvider(java.security.Provider provider)
-
-
-
Constructor Detail
-
EncryptionConfig
public EncryptionConfig(java.security.KeyStore keystore, char[] masterKeyPassword, java.lang.String masterKeyAlias) throws java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.InvalidKeyException, java.security.UnrecoverableKeyException
Creates a new EncryptionConfig object that will retrieve keys from a Keystore object. Note that currently, only RSA keys are supported.- Parameters:
keystore
- the Keystore containing the master encryption key and any additional decryption key(s).masterKeyPassword
- password for the master keys. Note that this implementation assumes that all master keys use the same password.masterKeyAlias
- name of the master encryption key in the Keystore object.- Throws:
java.security.KeyStoreException
- if the keystore has not been initialized properly.java.security.NoSuchAlgorithmException
- if the master key's algorithm is not available.java.security.InvalidKeyException
- if the master key alias is not found in the keystore.java.security.UnrecoverableKeyException
- if the master key is not readable (e.g. bad password)
-
EncryptionConfig
public EncryptionConfig(java.security.KeyPair masterEncryptionKey, java.util.Set<java.security.KeyPair> decryptionKeys)
Creates a new EncryptionConfig object that uses bare KeyPair objects.- Parameters:
masterEncryptionKey
- the KeyPair to use for encryption.decryptionKeys
- (optional) additional KeyPair objects available to decrypt objects.
-
EncryptionConfig
public EncryptionConfig(com.emc.codec.encryption.KeyProvider keyProvider)
-
EncryptionConfig
public EncryptionConfig(EncryptionConfig other)
Cloning constructor.
-
-
Method Detail
-
getKeyProvider
public com.emc.codec.encryption.KeyProvider getKeyProvider()
-
getKeySize
public int getKeySize()
-
setKeySize
public void setKeySize(int keySize)
Set the size of encryption key to use, either 128 or 256. Note that to use 256-bit AES keys, you will probably need the unlimited strength jurisdiction files installed in your JRE.
-
getSecurityProvider
public java.security.Provider getSecurityProvider()
-
setSecurityProvider
public void setSecurityProvider(java.security.Provider provider)
Set the Java security provider to use for all encryption operations. If not specified, the default provider(s) will be used from your java.security file.
-
getEncryptionSpec
public java.lang.String getEncryptionSpec()
-
setEncryptionSpec
public void setEncryptionSpec(java.lang.String encryptionSpec)
-
isCompressionEnabled
public boolean isCompressionEnabled()
-
setCompressionEnabled
public void setCompressionEnabled(boolean compressionEnabled)
If set to true, will enable compression for objects created with the encryption client.
-
getCompressionSpec
public java.lang.String getCompressionSpec()
-
setCompressionSpec
public void setCompressionSpec(java.lang.String compressionSpec)
Sets the compression spec to use for compression. Defaults to Deflate, level 5.- See Also:
DeflateCodec.encodeSpec(int)
-
getCodecProperties
public java.util.Map<java.lang.String,java.lang.Object> getCodecProperties()
-
setCodecProperties
public void setCodecProperties(java.util.Map<java.lang.String,java.lang.Object> codecProperties)
-
withKeySize
public EncryptionConfig withKeySize(int keySize)
- See Also:
setKeySize(int)
-
withSecurityProvider
public EncryptionConfig withSecurityProvider(java.security.Provider provider)
- See Also:
setSecurityProvider(Provider)
-
withEncryptionSpec
public EncryptionConfig withEncryptionSpec(java.lang.String encryptionSpec)
-
withCompressionEnabled
public EncryptionConfig withCompressionEnabled(boolean compressionEnabled)
-
withCompressionSpec
public EncryptionConfig withCompressionSpec(java.lang.String compressionSpec)
-
-