use of com.azure.security.keyvault.keys.cryptography.CryptographyClientBuilder in project mssql-jdbc by Microsoft.
the class SQLServerColumnEncryptionAzureKeyVaultProvider method getCryptographyClient.
private CryptographyClient getCryptographyClient(String masterKeyPath) throws SQLServerException {
if (this.cachedCryptographyClients.containsKey(masterKeyPath)) {
return cachedCryptographyClients.get(masterKeyPath);
}
KeyVaultKey retrievedKey = getKeyVaultKey(masterKeyPath);
CryptographyClient cryptoClient;
if (null != credential) {
cryptoClient = new CryptographyClientBuilder().credential(credential).keyIdentifier(retrievedKey.getId()).buildClient();
} else {
cryptoClient = new CryptographyClientBuilder().pipeline(keyVaultPipeline).keyIdentifier(retrievedKey.getId()).buildClient();
}
cachedCryptographyClients.putIfAbsent(masterKeyPath, cryptoClient);
return cachedCryptographyClients.get(masterKeyPath);
}
use of com.azure.security.keyvault.keys.cryptography.CryptographyClientBuilder in project mssql-jdbc by microsoft.
the class SQLServerColumnEncryptionAzureKeyVaultProvider method getCryptographyClient.
private CryptographyClient getCryptographyClient(String masterKeyPath) throws SQLServerException {
if (this.cachedCryptographyClients.containsKey(masterKeyPath)) {
return cachedCryptographyClients.get(masterKeyPath);
}
KeyVaultKey retrievedKey = getKeyVaultKey(masterKeyPath);
CryptographyClient cryptoClient;
if (null != credential) {
cryptoClient = new CryptographyClientBuilder().credential(credential).keyIdentifier(retrievedKey.getId()).buildClient();
} else {
cryptoClient = new CryptographyClientBuilder().pipeline(keyVaultPipeline).keyIdentifier(retrievedKey.getId()).buildClient();
}
cachedCryptographyClients.putIfAbsent(masterKeyPath, cryptoClient);
return cachedCryptographyClients.get(masterKeyPath);
}
use of com.azure.security.keyvault.keys.cryptography.CryptographyClientBuilder in project signers by ConsenSys.
the class AzureKeyVault method fetchKey.
public CryptographyClient fetchKey(final String keyName, final String keyVersion) {
final KeyVaultKey key = keyClient.getKey(keyName, keyVersion);
final String keyId = key.getId();
return new CryptographyClientBuilder().credential(tokenCredential).keyIdentifier(keyId).buildClient();
}
Aggregations