use of org.apache.cassandra.config.TransparentDataEncryptionOptions in project cassandra by apache.
the class EncryptionContextGenerator method createEncryptionOptions.
public static TransparentDataEncryptionOptions createEncryptionOptions() {
Map<String, String> params = new HashMap<>();
params.put("keystore", "test/conf/cassandra.keystore");
params.put("keystore_password", "cassandra");
params.put("store_type", "JCEKS");
ParameterizedClass keyProvider = new ParameterizedClass(JKSKeyProvider.class.getName(), params);
return new TransparentDataEncryptionOptions("AES/CBC/PKCS5Padding", KEY_ALIAS_1, keyProvider);
}
use of org.apache.cassandra.config.TransparentDataEncryptionOptions in project cassandra by apache.
the class CommitLogDescriptorTest method setup.
@Before
public void setup() {
Map<String, String> params = new HashMap<>();
compression = new ParameterizedClass(LZ4Compressor.class.getName(), params);
enabledTdeOptions = EncryptionContextGenerator.createEncryptionOptions();
enabledEncryption = new EncryptionContext(enabledTdeOptions, iv, false);
neverEnabledEncryption = EncryptionContextGenerator.createDisabledContext();
TransparentDataEncryptionOptions disaabledTdeOptions = new TransparentDataEncryptionOptions(false, enabledTdeOptions.cipher, enabledTdeOptions.key_alias, enabledTdeOptions.key_provider);
previouslyEnabledEncryption = new EncryptionContext(disaabledTdeOptions);
}
use of org.apache.cassandra.config.TransparentDataEncryptionOptions in project cassandra by apache.
the class EncryptionContext method createFromMap.
/**
* If encryption headers are found in the {@code parameters},
* those headers are merged with the application-wide {@code encryptionContext}.
*/
public static EncryptionContext createFromMap(Map<?, ?> parameters, EncryptionContext encryptionContext) {
if (parameters == null || parameters.isEmpty())
return new EncryptionContext(new TransparentDataEncryptionOptions(false));
String keyAlias = (String) parameters.get(ENCRYPTION_KEY_ALIAS);
String cipher = (String) parameters.get(ENCRYPTION_CIPHER);
String ivString = (String) parameters.get(ENCRYPTION_IV);
if (keyAlias == null || cipher == null)
return new EncryptionContext(new TransparentDataEncryptionOptions(false));
TransparentDataEncryptionOptions tdeOptions = new TransparentDataEncryptionOptions(cipher, keyAlias, encryptionContext.getTransparentDataEncryptionOptions().key_provider);
byte[] iv = ivString != null ? Hex.hexToBytes(ivString) : null;
return new EncryptionContext(tdeOptions, iv, true);
}
Aggregations