Search in sources :

Example 6 with SecretMetadata

use of io.cdap.cdap.securestore.spi.secret.SecretMetadata in project cdap by caskdata.

the class CloudSecretManager method store.

@Override
public void store(String namespace, Secret secret) throws IOException {
    // creates new crypto key for every namespace
    client.createCryptoKeyIfNotExists(CRYPTO_KEY_PREFIX + namespace);
    byte[] encryptedData = client.encrypt(CRYPTO_KEY_PREFIX + namespace, secret.getData());
    SecretMetadata metadata = secret.getMetadata();
    SecretInfo secretInfo = new SecretInfo(metadata.getName(), metadata.getDescription(), encryptedData, metadata.getCreationTimeMs(), metadata.getProperties());
    store.store(namespace, metadata.getName(), encoderDecoder, secretInfo);
}
Also used : SecretMetadata(io.cdap.cdap.securestore.spi.secret.SecretMetadata)

Aggregations

SecretMetadata (io.cdap.cdap.securestore.spi.secret.SecretMetadata)6 Secret (io.cdap.cdap.securestore.spi.secret.Secret)3 SecureStoreMetadata (io.cdap.cdap.api.security.store.SecureStoreMetadata)2 ArrayList (java.util.ArrayList)2 SecureStoreData (io.cdap.cdap.api.security.store.SecureStoreData)1 SecureKeyNotFoundException (io.cdap.cdap.common.SecureKeyNotFoundException)1 SecureKeyId (io.cdap.cdap.proto.id.SecureKeyId)1 SecretNotFoundException (io.cdap.cdap.securestore.spi.SecretNotFoundException)1