Search in sources :

Example 1 with TransparentDataEncryptionOptions

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);
}
Also used : HashMap(java.util.HashMap) ParameterizedClass(org.apache.cassandra.config.ParameterizedClass) TransparentDataEncryptionOptions(org.apache.cassandra.config.TransparentDataEncryptionOptions)

Example 2 with TransparentDataEncryptionOptions

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);
}
Also used : EncryptionContext(org.apache.cassandra.security.EncryptionContext) HashMap(java.util.HashMap) ParameterizedClass(org.apache.cassandra.config.ParameterizedClass) TransparentDataEncryptionOptions(org.apache.cassandra.config.TransparentDataEncryptionOptions) Before(org.junit.Before)

Example 3 with TransparentDataEncryptionOptions

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);
}
Also used : TransparentDataEncryptionOptions(org.apache.cassandra.config.TransparentDataEncryptionOptions)

Aggregations

TransparentDataEncryptionOptions (org.apache.cassandra.config.TransparentDataEncryptionOptions)3 HashMap (java.util.HashMap)2 ParameterizedClass (org.apache.cassandra.config.ParameterizedClass)2 EncryptionContext (org.apache.cassandra.security.EncryptionContext)1 Before (org.junit.Before)1