热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

com.amazonaws.services.kms.AWSKMSClientBuilder类的使用及代码示例

本文整理了Java中com.amazonaws.services.kms.AWSKMSClientBuilder类的一些代码示例,展示了AWSKMSClie

本文整理了Java中com.amazonaws.services.kms.AWSKMSClientBuilder类的一些代码示例,展示了AWSKMSClientBuilder类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AWSKMSClientBuilder类的具体详情如下:
包路径:com.amazonaws.services.kms.AWSKMSClientBuilder
类名称:AWSKMSClientBuilder

AWSKMSClientBuilder介绍

[英]Fluent builder for com.amazonaws.services.kms.AWSKMS. Use of the builder is preferred over using constructors of the client class.
[中]fluentbuilderforcom。亚马逊。服务。公里。AWSKMS。比起使用客户机类的构造函数,更倾向于使用生成器。

代码示例

代码示例来源:origin: aws/aws-sdk-java

/**
* @return Default client using the {@link com.amazonaws.auth.DefaultAWSCredentialsProviderChain} and
* {@link com.amazonaws.regions.DefaultAwsRegionProviderChain} chain
*/
public static AWSKMS defaultClient() {
return standard().build();
}

代码示例来源:origin: aws/aws-sdk-java

/**
* @return Create new instance of builder with all defaults set.
*/
public static AWSKMSClientBuilder standard() {
return new AWSKMSClientBuilder();
}

代码示例来源:origin: iterate-ch/cyberduck

private AWSKMS client(final Path container) throws BackgroundException {
final AWSKMSClientBuilder builder = AWSKMSClientBuilder.standard()
.withCredentials(AWSCredentialsConfigurator.toAWSCredentialsProvider(bookmark.getCredentials()))
.withClientConfiguration(configuration);
final Location.Name region = locationFeature.getLocation(container);
if(Location.unknown.equals(region)) {
builder.withRegion(Regions.DEFAULT_REGION);
}
else {
builder.withRegion(region.getIdentifier());
}
return builder.build();
}

代码示例来源:origin: Nextdoor/bender

public static String decrypt(String str, Region region) throws UnsupportedEncodingException {
if (isJUnitTest()) {
return str;
}
AWSKMS kms = AWSKMSClientBuilder.standard().withRegion(region.getName()).build();
/*
* The KMS ciphertext is base64 encoded and must be decoded before the request is made
*/
String cipherString = str;
byte[] cipherBytes = Base64.decode(cipherString);
/*
* Create decode request and decode
*/
ByteBuffer cipherBuffer = ByteBuffer.wrap(cipherBytes);
DecryptRequest req = new DecryptRequest().withCiphertextBlob(cipherBuffer);
DecryptResult resp = kms.decrypt(req);
/*
* Convert the response plaintext bytes to a string
*/
return new String(resp.getPlaintext().array(), Charset.forName("UTF-8"));
}
}

代码示例来源:origin: com.google.crypto.tink/tink

/** Loads AWS credentials from a provider. */
private KmsClient withCredentialsProvider(AWSCredentialsProvider provider)
throws GeneralSecurityException {
try {
this.client = AWSKMSClientBuilder.standard().withCredentials(provider).build();
return this;
} catch (AmazonServiceException e) {
throw new GeneralSecurityException("cannot load credentials from provider", e);
}
}

代码示例来源:origin: aws/aws-encryption-sdk-java

private RegionalClientSupplier clientFactory() {
if (regionalClientSupplier_ != null) {
return regionalClientSupplier_;
}
// Clone again; this MKP builder might be reused to build a second MKP with different creds.
AWSKMSClientBuilder builder = templateBuilder_ != null ? cloneClientBuilder(templateBuilder_)
: AWSKMSClientBuilder.standard();
ConcurrentHashMap clientCache = new ConcurrentHashMap<>();
snoopClientCache(clientCache);
return region -> {
AWSKMS kms = clientCache.get(region);
if (kms != null) return kms;
// We can't just use computeIfAbsent as we need to avoid leaking KMS clients if we're asked to decrypt
// an EDK with a bogus region in its ARN. So we'll install a request handler to identify the first
// successful call, and cache it when we see that.
SuccessfulRequestCacher cacher = new SuccessfulRequestCacher(clientCache, region);
ArrayList handlers = new ArrayList<>();
if (builder.getRequestHandlers() != null) {
handlers.addAll(builder.getRequestHandlers());
}
handlers.add(cacher);
kms = cloneClientBuilder(builder)
.withRegion(region)
.withRequestHandlers(handlers.toArray(new RequestHandler2[handlers.size()]))
.build();
cacher.client_ = kms;
return kms;
};
}

代码示例来源:origin: aws/aws-encryption-sdk-java

/**
* Returns an instance of this object with the supplied configuration and credentials. all keys
* listed in {@code keyIds} will be used to protect data.
*/
public KmsMasterKeyProvider(final AWSCredentialsProvider creds, final Region region,
final ClientConfiguration clientConfiguration, final List keyIds) {
this(builder().withClientBuilder(AWSKMSClientBuilder.standard()
.withClientConfiguration(clientConfiguration)
.withCredentials(creds))
.clientFactory(),
region.getName(),
keyIds
);
}

代码示例来源:origin: aws/aws-sdk-java

public static AWSKMSClientBuilder builder() {
return AWSKMSClientBuilder.standard();
}

代码示例来源:origin: zalando/spring-cloud-config-aws-kms

@Bean
public AWSKMS kms() {
final AWSKMSClientBuilder builder = AWSKMSClient.builder();
if (Optional.ofNullable(properties.getEndpoint()).isPresent()) {
builder.withEndpointConfiguration(new EndpointConfiguration(properties.getEndpoint().getServiceEndpoint(), properties.getEndpoint().getSigningRegion()));
} else {
Optional.ofNullable(properties.getRegion()).ifPresent(builder::setRegion);
}
return builder.build();
}

代码示例来源:origin: aws/aws-encryption-sdk-java

/**
* Configures the {@link KmsMasterKeyProvider} to use specific credentials. If a builder was previously set,
* this will override whatever credentials it set.
* @param credentialsProvider
* @return
*/
public Builder withCredentials(AWSCredentialsProvider credentialsProvider) {
if (regionalClientSupplier_ != null) {
throw clientSupplierComboException();
}
if (templateBuilder_ == null) {
templateBuilder_ = AWSKMSClientBuilder.standard();
}
templateBuilder_.setCredentials(credentialsProvider);
return this;
}

代码示例来源:origin: tmobile/pacbot

try{
if(!skipRegions.contains(region.getName())){
awskms = AWSKMSClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(temporaryCredentials)).withRegion(region.getName()).build();
List regiOnKeys= awskms.listKeys().getKeys();
List regiOnKeyAliases= awskms.listAliases().getAliases();

代码示例来源:origin: Nextdoor/bender

public static String decrypt(String str, Region region) throws UnsupportedEncodingException {
if (isJUnitTest()) {
return str;
}
AWSKMS kms = AWSKMSClientBuilder.standard().withRegion(region.getName()).build();
/*
* The KMS ciphertext is base64 encoded and must be decoded before the request is made
*/
String cipherString = str;
byte[] cipherBytes = Base64.decode(cipherString);
/*
* Create decode request and decode
*/
ByteBuffer cipherBuffer = ByteBuffer.wrap(cipherBytes);
DecryptRequest req = new DecryptRequest().withCiphertextBlob(cipherBuffer);
DecryptResult resp = kms.decrypt(req);
/*
* Convert the response plaintext bytes to a string
*/
return new String(resp.getPlaintext().array(), Charset.forName("UTF-8"));
}
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-kms

public static AWSKMSClientBuilder builder() {
return AWSKMSClientBuilder.standard();
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-kms

/**
* @return Default client using the {@link com.amazonaws.auth.DefaultAWSCredentialsProviderChain} and
* {@link com.amazonaws.regions.DefaultAwsRegionProviderChain} chain
*/
public static AWSKMS defaultClient() {
return standard().build();
}

代码示例来源:origin: Nextdoor/bender

public static AWSKMSClientBuilder builder() {
return AWSKMSClientBuilder.standard();
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-kms

/**
* @return Create new instance of builder with all defaults set.
*/
public static AWSKMSClientBuilder standard() {
return new AWSKMSClientBuilder();
}

代码示例来源:origin: Nextdoor/bender

/**
* @return Default client using the {@link com.amazonaws.auth.DefaultAWSCredentialsProviderChain} and
* {@link com.amazonaws.regions.DefaultAwsRegionProviderChain} chain
*/
public static AWSKMS defaultClient() {
return standard().build();
}

代码示例来源:origin: Nextdoor/bender

/**
* @return Create new instance of builder with all defaults set.
*/
public static AWSKMSClientBuilder standard() {
return new AWSKMSClientBuilder();
}

推荐阅读
  • 本文详细介绍了 `org.apache.tinkerpop.gremlin.structure.VertexProperty` 类中的 `key()` 方法,并提供了多个实际应用的代码示例。通过这些示例,读者可以更好地理解该方法在图数据库操作中的具体用途。 ... [详细]
  • 利用Node.js实现PSD文件的高效切图
    本文介绍了如何通过Node.js及其psd2json模块,快速实现PSD文件的自动化切图过程,以适应项目中频繁的界面更新需求。此方法不仅提高了工作效率,还简化了从设计稿到实际应用的转换流程。 ... [详细]
  • 入门指南:使用FastRPC技术连接Qualcomm Hexagon DSP
    本文旨在为初学者提供关于如何使用FastRPC技术连接Qualcomm Hexagon DSP的基础知识。FastRPC技术允许开发者在本地客户端实现远程调用,从而简化Hexagon DSP的开发和调试过程。 ... [详细]
  • importjava.io.*;importjava.util.*;publicclass五子棋游戏{staticintm1;staticintn1;staticfinalintS ... [详细]
  • 小编给大家分享一下Vue3中如何提高开发效率,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获, ... [详细]
  • linux网络子系统分析(二)—— 协议栈分层框架的建立
    目录一、综述二、INET的初始化2.1INET接口注册2.2抽象实体的建立2.3代码细节分析2.3.1socket参数三、其他协议3.1PF_PACKET3.2P ... [详细]
  • 本文详细介绍了如何在 Vue CLI 3.0 和 2.0 中配置 proxy 来解决开发环境下的跨域问题,包括具体的配置项和使用场景。 ... [详细]
  • 深入理解Java SE 8新特性:Lambda表达式与函数式编程
    本文作为‘Java SE 8新特性概览’系列的一部分,将详细探讨Lambda表达式。通过多种示例,我们将展示Lambda表达式的不同应用场景,并解释编译器如何处理这些表达式。 ... [详细]
  • 本文详细探讨了 Java 中 org.apache.gobblin.metrics.GobblinMetrics 类下的 getName() 方法的使用场景及其代码实现,提供了多个实际应用示例以加深理解。 ... [详细]
  • 处理Android EditText中数字输入与parseInt方法
    本文探讨了如何在Android应用中从EditText组件安全地获取并解析用户输入的数字,特别是用于设置端口号的情况。通过示例代码和异常处理策略,展示了有效的方法来避免因非法输入导致的应用崩溃。 ... [详细]
  • 函子(Functor)是函数式编程中的一个重要概念,它不仅是一个特殊的容器,还提供了一种优雅的方式来处理值和函数。本文将详细介绍函子的基本概念及其在函数式编程中的应用,包括如何通过函子控制副作用、处理异常以及进行异步操作。 ... [详细]
  • 在1995年,Simon Plouffe 发现了一种特殊的求和方法来表示某些常数。两年后,Bailey 和 Borwein 在他们的论文中发表了这一发现,这种方法被命名为 Bailey-Borwein-Plouffe (BBP) 公式。该问题要求计算圆周率 π 的第 n 个十六进制数字。 ... [详细]
  • 本文详细介绍了 Java 中 org.apache.jena.atlas.lib.ByteBufferLib 类下的 acopyArray 方法,并提供了多个实际应用中的代码示例,帮助开发者更好地理解和使用该方法。 ... [详细]
  • 从理想主义者的内心深处萌发的技术信仰,推动了云原生技术在全球范围内的快速发展。本文将带你深入了解阿里巴巴在开源领域的贡献与成就。 ... [详细]
  • 高级缩放示例.就像谷歌地图一样.它仅缩放图块,但不缩放整个图像.因此,缩放的瓷砖占据了恒定的记忆,并且不会为大型缩放图像调整大小的图像.对于简化的缩放示例lookhere.在Win ... [详细]
author-avatar
红骑兵
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有