热门标签 | 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();
}

推荐阅读
  • Explore how Matterverse is redefining the metaverse experience, creating immersive and meaningful virtual environments that foster genuine connections and economic opportunities. ... [详细]
  • Explore a common issue encountered when implementing an OAuth 1.0a API, specifically the inability to encode null objects and how to resolve it. ... [详细]
  • 本文详细介绍了Java中org.eclipse.ui.forms.widgets.ExpandableComposite类的addExpansionListener()方法,并提供了多个实际代码示例,帮助开发者更好地理解和使用该方法。这些示例来源于多个知名开源项目,具有很高的参考价值。 ... [详细]
  • 本文介绍了如何使用 Spring Boot DevTools 实现应用程序在开发过程中自动重启。这一特性显著提高了开发效率,特别是在集成开发环境(IDE)中工作时,能够提供快速的反馈循环。默认情况下,DevTools 会监控类路径上的文件变化,并根据需要触发应用重启。 ... [详细]
  • 本文详细介绍了如何在Linux系统上安装和配置Smokeping,以实现对网络链路质量的实时监控。通过详细的步骤和必要的依赖包安装,确保用户能够顺利完成部署并优化其网络性能监控。 ... [详细]
  • 本文详细介绍了 Dockerfile 的编写方法及其在网络配置中的应用,涵盖基础指令、镜像构建与发布流程,并深入探讨了 Docker 的默认网络、容器互联及自定义网络的实现。 ... [详细]
  • 使用 Azure Service Principal 和 Microsoft Graph API 获取 AAD 用户列表
    本文介绍了一段通用代码示例,该代码不仅能够操作 Azure Active Directory (AAD),还可以通过 Azure Service Principal 的授权访问和管理 Azure 订阅资源。Azure 的架构可以分为两个层级:AAD 和 Subscription。 ... [详细]
  • 深入解析Spring Cloud Ribbon负载均衡机制
    本文详细介绍了Spring Cloud中的Ribbon组件如何实现服务调用的负载均衡。通过分析其工作原理、源码结构及配置方式,帮助读者理解Ribbon在分布式系统中的重要作用。 ... [详细]
  • 本文深入探讨了 Java 中的 Serializable 接口,解释了其实现机制、用途及注意事项,帮助开发者更好地理解和使用序列化功能。 ... [详细]
  • 本文详细介绍了Java中org.w3c.dom.Text类的splitText()方法,通过多个代码示例展示了其实际应用。该方法用于将文本节点在指定位置拆分为两个节点,并保持在文档树中。 ... [详细]
  • 2023年京东Android面试真题解析与经验分享
    本文由一位拥有6年Android开发经验的工程师撰写,详细解析了京东面试中常见的技术问题。涵盖引用传递、Handler机制、ListView优化、多线程控制及ANR处理等核心知识点。 ... [详细]
  • 本文介绍如何使用阿里云的fastjson库解析包含时间戳、IP地址和参数等信息的JSON格式文本,并进行数据处理和保存。 ... [详细]
  • 本文介绍了如何通过配置 Android Studio 和 Gradle 来显著提高构建性能,涵盖内存分配优化、并行构建和性能分析等实用技巧。 ... [详细]
  • 深入解析 Spring Security 用户认证机制
    本文将详细介绍 Spring Security 中用户登录认证的核心流程,重点分析 AbstractAuthenticationProcessingFilter 和 AuthenticationManager 的工作原理。通过理解这些组件的实现,读者可以更好地掌握 Spring Security 的认证机制。 ... [详细]
  • 本文探讨了在使用Azure Active Directory进行用户身份验证时,结合AddAuthentication和RequireAuthenticatedUser的必要性及其潜在冗余问题。 ... [详细]
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社区 版权所有