- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中javax.security.auth.x500.X500PrivateCredential
类的一些代码示例,展示了X500PrivateCredential
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。X500PrivateCredential
类的具体详情如下:
包路径:javax.security.auth.x500.X500PrivateCredential
类名称:X500PrivateCredential
暂无
代码示例来源:origin: wildfly/wildfly
private static IdentityCredentials getSingleCredential(Object rawCredential) {
if (rawCredential == null) {
return IdentityCredentials.NONE;
} else if (rawCredential instanceof Credential) {
return IdentityCredentials.NONE.withCredential((Credential) rawCredential);
} else if (rawCredential instanceof GSSCredential) {
return IdentityCredentials.NONE.withCredential(new GSSKerberosCredential((GSSCredential) rawCredential));
} else if (rawCredential instanceof Password) {
return IdentityCredentials.NONE.withCredential(new PasswordCredential((Password) rawCredential));
} else if (rawCredential instanceof X509Certificate) {
return IdentityCredentials.NONE.withCredential(new X509CertificateChainPublicCredential((X509Certificate) rawCredential));
} else if (rawCredential instanceof X509Certificate[]) {
return IdentityCredentials.NONE.withCredential(new X509CertificateChainPublicCredential((X509Certificate[]) rawCredential));
} else if (rawCredential instanceof X500PrivateCredential) {
final X500PrivateCredential credential = (X500PrivateCredential) rawCredential;
return IdentityCredentials.NONE.withCredential(new X509CertificateChainPrivateCredential(credential.getPrivateKey(), credential.getCertificate()));
} else if (rawCredential instanceof String) {
return IdentityCredentials.NONE.withCredential(new PasswordCredential(ClearPassword.createRaw(ClearPassword.ALGORITHM_CLEAR, ((String) rawCredential).toCharArray())));
} else if (rawCredential instanceof char[]) {
// todo: automatically decode to other credential types
return IdentityCredentials.NONE.withCredential(new PasswordCredential(ClearPassword.createRaw(ClearPassword.ALGORITHM_CLEAR, (char[]) rawCredential)));
} else if (rawCredential instanceof byte[]) {
// todo: automatically decode to other credential types
return IdentityCredentials.NONE.withCredential(new PasswordCredential(ClearPassword.createRaw(ClearPassword.ALGORITHM_CLEAR, new String((byte[]) rawCredential, StandardCharsets.UTF_8).toCharArray())));
} else {
return IdentityCredentials.NONE;
}
}
代码示例来源:origin: stackoverflow.com
KeyStore ks = KeyStore.getInstance(KEYSTORE_TYPE, "BC");
ks.load(new FileInputStream(KEYSTORE_FILE), KEYSTORE_PWD);
X500PrivateCredential creds = new X500PrivateCredential(
(X509Certificate) ks.getCertificate(KEYSTORE_ALIAS),
(PrivateKey) ks.getKey(KEYSTORE_ALIAS, KEYSTORE_PWD)
new JcaDigestCalculatorProviderBuilder().setProvider("BC").build()
).build(
new JcaContentSignerBuilder("SHA1withRSA").setProvider("BC").build(creds.getPrivateKey()),
creds.getCertificate()
代码示例来源:origin: au.net.zeus.jgdms/jgdms-rmi-tls
if (cred instanceof X500PrivateCredential) {
X500PrivateCredential xpc = (X500PrivateCredential) cred;
if (cert.equals(xpc.getCertificate())) {
result = xpc;
break;
代码示例来源:origin: net.sf.wsag4j/wsag4j-api
userCredential = new X500PrivateCredential( userCertificateChain[0], userKey );
new X500Principal( userCredential.getCertificate().getSubjectX500Principal().getName() );
代码示例来源:origin: com.hynnet/xws-security
while (it.hasNext()) {
X500PrivateCredential cred = (X500PrivateCredential)it.next();
if (cred.getAlias().equals(actualAlias))
return cred.getCertificate();
代码示例来源:origin: au.net.zeus.jgdms/jgdms-rmi-tls
throw new GeneralSecurityException(
"Client is not authenticated");
} else if (clientCredential.isDestroyed()) {
throw new GeneralSecurityException(
"Private credentials are destroyed");
X509Certificate cert = clientCredential.getCertificate();
if (getPrincipal(subject, cert) == null) {
throw new GeneralSecurityException("Missing principal");
代码示例来源:origin: au.net.zeus.jgdms/jgdms-rmi-tls
new GetPrivateCredentialAction(subject, cert));
PrivateKey privateKey =
cred != null ? cred.getPrivateKey() : null;
if (privateKey == null) {
buf.append("Not found");
代码示例来源:origin: stackoverflow.com
KeyStore ks = KeyStore.getInstance(KEYSTORE_TYPE, "BC");
ks.load(new FileInputStream(KEYSTORE_FILE), KEYSTORE_PWD);
X500PrivateCredential creds = new X500PrivateCredential(
(X509Certificate) ks.getCertificate(KEYSTORE_ALIAS),
(PrivateKey) ks.getKey(KEYSTORE_ALIAS, KEYSTORE_PWD)
signature.initSign(creds.getPrivateKey());
signature.update(fileContent);
new JcaDigestCalculatorProviderBuilder().setProvider("BC").build()
).build(
new JcaContentSignerBuilder("SHA1withRSA").setProvider("BC").build(creds.getPrivateKey()),
creds.getCertificate()
代码示例来源:origin: au.net.zeus.jgdms/jgdms-rmi-tls
X509Certificate cert = clientCredential.getCertificate();
clientPrincipal = cert.getSubjectX500Principal();
credentialsValidUntil = Math.min(credentialsValidUntil, certificatesValidUntil(getCertificateChain(getSubject(), cert)));
authenticationPermission = getAuthenticationPermission(cert);
String result = getCertificateName(clientCredential.getCertificate());
if (logger.isLoggable(Level.FINE)) {
logger.log(
代码示例来源:origin: com.hynnet/xws-security
while (it.hasNext()) {
X500PrivateCredential cred = (X500PrivateCredential)it.next();
if (cred.getAlias().equals(alias))
return cred.getCertificate();
代码示例来源:origin: au.net.zeus.jgdms/jgdms-rmi-tls
public PrivateKey getPrivateKey(String alias) {
CertPath chain =
getCertificateChain(getSubject(), alias);
if (chain != null) {
try {
X500PrivateCredential xpc =
getPrivateCredential(firstX509Cert(chain));
if (xpc != null) {
return xpc.getPrivateKey();
}
} catch (SecurityException e) {
Logger logger = getLogger();
if (logger.isLoggable(Levels.HANDLED)) {
logThrow(logger, Levels.HANDLED,
SubjectKeyManager.class, "getPrivateKey",
"get private key for alias {0}\n" +
"caught exception",
new Object[] { alias },
e);
}
}
}
return null;
}
代码示例来源:origin: au.net.zeus.jgdms/jgdms-rmi-tls
/**
* Checks if the two private credentials refer to the same principal and
* have the equivalent private key.
*/
boolean equalPrivateCredentials(X500PrivateCredential cred1,
X500PrivateCredential cred2)
{
if (cred1 == null || cred2 == null) {
return false;
}
X509Certificate cert1 = cred1.getCertificate();
X509Certificate cert2 = cred2.getCertificate();
if (cert1 == null
|| cert2 == null
|| !safeEquals(cert1.getSubjectDN(), cert2.getSubjectDN()))
{
return false;
}
/*
* I'm assuming I can depend on the equals method for private keys to
* check if the two objects represent the same key without being
* identical objects. Although that behavior isn't documented, at
* least the sun.security.pkcs.PKCS8Key class does that.
* -tjb[8.Jan.2001]
*/
PrivateKey key1 = cred1.getPrivateKey();
return key1 != null && key1.equals(cred2.getPrivateKey());
}
代码示例来源:origin: stackoverflow.com
KeyStore ks = KeyStore.getInstance(KEYSTORE_TYPE, "BC");
ks.load(new FileInputStream(KEYSTORE_FILE), KEYSTORE_PWD);
X500PrivateCredential creds = new X500PrivateCredential(
(X509Certificate) ks.getCertificate(KEYSTORE_ALIAS),
(PrivateKey) ks.getKey(KEYSTORE_ALIAS, KEYSTORE_PWD)
new JcaDigestCalculatorProviderBuilder().setProvider("BC").build()
).build(
new JcaContentSignerBuilder("SHA1withRSA").setProvider("BC").build(creds.getPrivateKey()),
creds.getCertificate()
代码示例来源:origin: au.net.zeus.jgdms/jgdms-rmi-tls
for (int i = readOnlyPrivateCredentials.length; --i >= 0; ) {
X500PrivateCredential xpc = readOnlyPrivateCredentials[i];
if (cert.equals(xpc.getCertificate())) {
return xpc;
代码示例来源:origin: stackoverflow.com
private static void createSignature(Path srcfile, X500PrivateCredential creds, FileOutputStream target) throws Exception {
CMSSignedDataStreamGenerator gen = new CMSSignedDataStreamGenerator() {
{
addSignerInfoGenerator(
new JcaSignerInfoGeneratorBuilder(
new JcaDigestCalculatorProviderBuilder().setProvider("BC").build()
).build(
new JcaContentSignerBuilder("SHA1withRSA").setProvider("BC").build(creds.getPrivateKey()),
creds.getCertificate()
)
);
addCertificates(new JcaCertStore(new ArrayList<X509Certificate>() {
{
add(creds.getCertificate());
}
}));
}
};
try (OutputStream sigOut = gen.open(target, true)) {
Files.copy(srcfile, sigOut);
}
}
代码示例来源:origin: com.hynnet/xws-security
while (it.hasNext()) {
X500PrivateCredential cred = (X500PrivateCredential)it.next();
X509Certificate cert = cred.getCertificate();
if (cert.getPublicKey().equals(publicKey))
return cert;
代码示例来源:origin: com.hynnet/xws-security
while (it.hasNext()) {
X500PrivateCredential cred = (X500PrivateCredential)it.next();
X509Certificate x509Cert = cred.getCertificate();
BigInteger serialNo = x509Cert.getSerialNumber();
String currentIssuerName =
if (serialNo.equals(serialNumber) &&
currentIssuerName.equals(issuerName)) {
return cred.getPrivateKey();
代码示例来源:origin: au.net.zeus.jgdms/jgdms-rmi-tls
throw new SecurityException("Missing subject");
X509Certificate cert = cred.getCertificate();
if (getPrincipal(subject, cert) == null) {
throw new SecurityException("Missing principal");
代码示例来源:origin: com.hynnet/xws-security
while (it.hasNext()) {
X500PrivateCredential cred = (X500PrivateCredential)it.next();
X509Certificate x509Cert = cred.getCertificate();
BigInteger serialNo = x509Cert.getSerialNumber();
String currentIssuerName =
if (serialNo.equals(serialNumber) &&
currentIssuerName.equals(issuerName)) {
return cred.getPrivateKey();
代码示例来源:origin: au.net.zeus.jgdms/jgdms-rmi-tls
: getCertificateName(cred.getCertificate());
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE,
主要问题是可以从已保存的 Auth 对象设置零 Auth 对象: let oldAuth = Auth.auth().currentUser let oldAuthId = Auth.auth().c
何时使用 this.afAuth.auth.signInWithCredential 在我的 Ionic 应用程序中一切正常。我可以使用 Google 身份验证登录并将用户个人资料推送到 fireba
我想在启动时使用我的测试用户帐户预加载 firebase auth 模拟器,就像我对 Firestore 模拟器及其导入/导出选项所做的一样。我尝试在模拟器运行时使用 auth:import 和 au
我正在尝试通过创建 Firebase DataService 来 DRY 我的应用程序,但我不知道为 Auth.auth() 转换什么类型。我查看了源代码定义,但它在我不理解的 Objective C
我有一个更新用户个人资料图片的组件:。我有第二个组件检测用户状态的变化:。问题是,在执行updateProfile()之后,没有触发auth.onAuthStateChanged()。因此,我得到了老
我正在使用 Facebook Javascript SDK,并且正在调整我网站的用户登录系统。我想知道 auth.login/auth.logout 和 auth.sessionChange 之间有什
目前,我正在完成Daniel Kehoe的Learn Ruby on Rails教程。练习之一是使用Google的Gmail帐户从“联系人”页面发送联系人表格。 但是,当我发送联系表格时,没有在邮箱中
我在我的应用中使用 Firebase Auth。我更新电子邮件如下: firebaseAuth.currentUser?.updateEmail(email) 电子邮件正在 100% 更新(必要时我也
在我的应用程序中,当我第一次让用户加入时,我会让他们登录并确认这有效,并且他们会获得一个用户 ID。但稍后在我的 Storyboard 中,我调用了 Auth.auth.currentUser.uid
我是编程新手,我正在尝试从 firebase 数据库中读取数据。我从 Firebase 手册中得到这段代码,我想知道术语 uid,AUTH.auth() 在这里是什么意思。它是一个变量吗?我从 fir
已结束。此问题不符合 Stack Overflow guidelines .它目前不接受答案。 我们不允许提出有关书籍、工具、软件库等方面的建议的问题。您可以编辑问题,以便用事实和引用来回答它。 关闭
背景 我构建了一个连接到 Authorize.net 支付网关的电子商务应用程序。管理员可以通过以下方式处理信用卡: 管理员立即从客户的信用卡中扣款的“捕获”交易。 “仅授权”交易,管理员从信用卡中授
我正在使用 dj-rest-auth ( https://dj-rest-auth.readthedocs.io/en/latest/ ) 并尝试实现自定义注册表单。当我尝试注册新用户时,我有基本表单
我们正在使用 Azure Web App Easy Auth,并使用 Web App 作为反向代理,将流量转发到 Angular 应用程序。 角度应用程序使用/.auth/me 并使用 token 并
我有一个 Controller 和一个如下所示的 View ,它在一段时间内工作完美,但是在向服务器发出一些请求后(即每秒重新加载一次),它将在此行失败 if (!$this->tank_auth-
我希望在单个 Web 应用程序中,部分部分使用身份验证,部分部分完全开放(或者更具体地说,不使用基于容器的身份验证)。 使用基于容器的身份验证的应用程序部分位于 URL /而打开的部分位于 URL /
只要我按下按钮调用 signOut 方法,当前 View Controller 就会被关闭。但是,注销过程是成功的。 (我正在使用 FirebaseAuth SDK。) 这是我的代码: @IBActi
对于Firebase iOS,如果我想做用户认证,这3个选择有什么区别吗? FirebaseUI FirebaseUI/授权 Firebase/授权 如果有人可以解释使用“预构建”FirebaseUI
我正在使用 Vue-auth 包来验证我的 vue-cli 应用程序。一切正常,但当我在我的 vue 操作中访问此代码时,它返回 undefined。有什么想法吗? const AuthService
所以我正在使用 Laravel 身份验证,第一次它工作正常,但删除 Auth 文件夹后,我再次运行 php artisan make:auth 但它不会创建另一个 Auth 文件夹。 View 和模型
我是一名优秀的程序员,十分优秀!