use of com.qcloud.cos.internal.crypto.EncryptionMaterialsProvider in project cos-java-sdk-v5 by tencentyun.
the class AbstractCOSClientTest method initEncryptionClient.
protected static void initEncryptionClient() {
COSCredentials cred = new BasicCOSCredentials(secretId, secretKey);
clientConfig = new ClientConfig(new Region(region));
if (generalApiEndpoint != null && generalApiEndpoint.trim().length() > 0 && serviceApiEndpoint != null && serviceApiEndpoint.trim().length() > 0) {
UserSpecifiedEndpointBuilder userSpecifiedEndpointBuilder = new UserSpecifiedEndpointBuilder(generalApiEndpoint, serviceApiEndpoint);
clientConfig.setEndpointBuilder(userSpecifiedEndpointBuilder);
}
EncryptionMaterialsProvider encryptionMaterialsProvider;
if (encryptionMaterials instanceof KMSEncryptionMaterials) {
KMSEncryptionMaterials kmsEncryptionMaterials = new KMSEncryptionMaterials(cmk);
encryptionMaterialsProvider = new KMSEncryptionMaterialsProvider(kmsEncryptionMaterials);
} else {
encryptionMaterialsProvider = new StaticEncryptionMaterialsProvider(encryptionMaterials);
}
cosclient = new COSEncryptionClient(qcloudkms, new COSStaticCredentialsProvider(cred), encryptionMaterialsProvider, clientConfig, cryptoConfiguration);
}
Aggregations