当前位置: 首页>>代码示例>>Java>>正文


Java AWSKMSClient.setRegion方法代码示例

本文整理汇总了Java中com.amazonaws.services.kms.AWSKMSClient.setRegion方法的典型用法代码示例。如果您正苦于以下问题:Java AWSKMSClient.setRegion方法的具体用法?Java AWSKMSClient.setRegion怎么用?Java AWSKMSClient.setRegion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.amazonaws.services.kms.AWSKMSClient的用法示例。


在下文中一共展示了AWSKMSClient.setRegion方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newAWSKMSClient

import com.amazonaws.services.kms.AWSKMSClient; //导入方法依赖的package包/类
/**
 * Creates and returns a new instance of AWS KMS client in the case when
 * an explicit AWS KMS client is not specified.
 */
private AWSKMSClient newAWSKMSClient(
        AWSCredentialsProvider credentialsProvider,
        ClientConfiguration clientConfig,
        CryptoConfiguration cryptoConfig,
        RequestMetricCollector requestMetricCollector
) {
    final AWSKMSClient kmsClient = new AWSKMSClient(
        credentialsProvider, clientConfig, requestMetricCollector);
    final Region kmsRegion = cryptoConfig.getAwsKmsRegion();
    if (kmsRegion != null)
        kmsClient.setRegion(kmsRegion);
    return kmsClient;
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:18,代码来源:AmazonS3EncryptionClient.java

示例2: build

import com.amazonaws.services.kms.AWSKMSClient; //导入方法依赖的package包/类
public AWSKMSClient build() {
    ClientConfiguration config = new ClientConfiguration();
    if (!Util.fixNull(host).trim().isEmpty()) {
        config.setProxyHost(this.host);
        config.setProxyPort(this.port);
    }
    AWSKMSClient client = new AWSKMSClient(new DefaultAWSCredentialsProviderChain(), config);
    if (!Util.fixNull(region).trim().isEmpty()) {
        client.setRegion(Region.getRegion(Regions.fromName(region)));
    }
    return client;
}
 
开发者ID:stevegal,项目名称:jenkins-aws-bucket-credentials,代码行数:13,代码来源:AwsKmsClientBuilder.java

示例3: getClient

import com.amazonaws.services.kms.AWSKMSClient; //导入方法依赖的package包/类
/**
 * Returns a KMS client for the given region.  Clients are cached by region.
 *
 * @param region Region to configure a client for
 * @return AWS KMS client
 */
public AWSKMSClient getClient(Region region) {
    AWSKMSClient client = kmsClientMap.get(region);

    if (client == null) {
        final AWSKMSClient newClient = new AWSKMSClient();
        newClient.setRegion(region);
        kmsClientMap.put(region, newClient);
        client = newClient;
    }

    return client;
}
 
开发者ID:Nike-Inc,项目名称:cerberus-management-service,代码行数:19,代码来源:KmsClientFactory.java

示例4: getAndSetToken

import com.amazonaws.services.kms.AWSKMSClient; //导入方法依赖的package包/类
/**
 * Authenticates with Cerberus and decrypts and sets the token and expiration details.
 *
 * @param iamPrincipalArn AWS IAM principal ARN used to auth with cerberus
 * @param region          AWS Region used in auth with cerberus
 */
protected void getAndSetToken(final String iamPrincipalArn, final Region region) {
    final AWSKMSClient kmsClient = new AWSKMSClient();
    kmsClient.setRegion(region);

    final String encryptedAuthData = getEncryptedAuthData(iamPrincipalArn, region);
    final VaultAuthResponse decryptedToken = decryptToken(kmsClient, encryptedAuthData);
    final DateTime expires = DateTime.now(DateTimeZone.UTC)
            .plusSeconds(decryptedToken.getLeaseDuration() - paddingTimeInSeconds);

    credentials = new TokenVaultCredentials(decryptedToken.getClientToken());
    expireDateTime = expires;
}
 
开发者ID:Nike-Inc,项目名称:cerberus-java-client,代码行数:19,代码来源:BaseAwsCredentialsProvider.java

示例5: decrypt

import com.amazonaws.services.kms.AWSKMSClient; //导入方法依赖的package包/类
/**
 * Decrypts the given encrypted bytes with the given encryption context.
 * Assumes the runtime has access to the desired AWS environment.
 *
 * @param region            the region
 * @param encryptionContext optional encryption context
 * @param encryptedBytes    the encrypted bytes
 * @return the decrypted bytes
 */
public static byte[] decrypt(Region region, Map<String, String> encryptionContext, byte[] encryptedBytes) {
    DecryptRequest decryptRequest = new DecryptRequest();
    decryptRequest.setEncryptionContext(encryptionContext);
    decryptRequest.setCiphertextBlob(ByteBuffer.wrap(encryptedBytes));

    AWSKMSClient client = new AWSKMSClient();
    client.setRegion(region);
    DecryptResult decryptResult = client.decrypt(decryptRequest);

    return decryptResult.getPlaintext().array();
}
 
开发者ID:gravieinc,项目名称:aws-crypto-tools-java,代码行数:21,代码来源:AwsKmsUtil.java


注:本文中的com.amazonaws.services.kms.AWSKMSClient.setRegion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。