use of com.qaprosoft.carina.core.foundation.crypto.CryptoTool in project carina by qaprosoft.
the class AmazonS3Manager method getInstance.
public static synchronized AmazonS3Manager getInstance() {
if (instance == null) {
instance = new AmazonS3Manager();
CryptoTool cryptoTool = new CryptoTool(Configuration.get(Parameter.CRYPTO_KEY_PATH));
Pattern CRYPTO_PATTERN = Pattern.compile(SpecialKeywords.CRYPT);
String accessKey = cryptoTool.decryptByPattern(Configuration.get(Parameter.ACCESS_KEY_ID), CRYPTO_PATTERN);
String secretKey = cryptoTool.decryptByPattern(Configuration.get(Parameter.SECRET_KEY), CRYPTO_PATTERN);
System.setProperty("aws.accessKeyId", accessKey);
System.setProperty("aws.secretKey", secretKey);
s3client = new AmazonS3Client(new SystemPropertiesCredentialsProvider());
}
return instance;
}
use of com.qaprosoft.carina.core.foundation.crypto.CryptoTool in project carina by qaprosoft.
the class AzureManager method getInstance.
public static synchronized AzureManager getInstance() {
if (instance == null) {
instance = new AzureManager();
CryptoTool cryptoTool = new CryptoTool(Configuration.get(Configuration.Parameter.CRYPTO_KEY_PATH));
Pattern CRYPTO_PATTERN = Pattern.compile(SpecialKeywords.CRYPT);
String accountName = Configuration.get(Configuration.Parameter.AZURE_ACCOUNT_NAME);
String endpoint = cryptoTool.decryptByPattern(Configuration.get(Configuration.Parameter.AZURE_BLOB_URL), CRYPTO_PATTERN);
String secretKey = cryptoTool.decryptByPattern(Configuration.get(Configuration.Parameter.AZURE_ACCESS_KEY_TOKEN), CRYPTO_PATTERN);
// Create a SharedKeyCredential
StorageSharedKeyCredential credential = new StorageSharedKeyCredential(accountName, secretKey);
// Create a blobServiceClient
blobServiceClient = new BlobServiceClientBuilder().endpoint(endpoint).credential(credential).buildClient();
}
return instance;
}
Aggregations