org.wildfly.security.credential.X509CertificateChainPublicCredential类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(14.1k)|赞(0)|评价(0)|浏览(187)

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

X509CertificateChainPublicCredential介绍

[英]A credential containing an X.509 certificate chain.
[中]包含X.509证书链的凭证。

代码示例

代码示例来源:origin: wildfly/wildfly

  1. private void parseCertificate(final List<Credential> credentials, final XMLStreamReader streamReader) throws RealmUnavailableException, XMLStreamException {
  2. parseCredential(streamReader, (algorithm, format, text) -> {
  3. if (algorithm == null) algorithm = "X.509";
  4. if (format == null) format = X509_FORMAT;
  5. try {
  6. final CertificateFactory certificateFactory = CertificateFactory.getInstance(algorithm);
  7. credentials.add(new X509CertificateChainPublicCredential((X509Certificate) certificateFactory.generateCertificate(
  8. CodePointIterator.ofString(text).base64Decode().asInputStream())));
  9. } catch (CertificateException | ClassCastException e) {
  10. throw ElytronMessages.log.fileSystemRealmCertificateReadError(format, path, streamReader.getLocation().getLineNumber(), name);
  11. }
  12. });
  13. }

代码示例来源:origin: org.jboss.eap/wildfly-webservices-server-integration

  1. subject.getPublicCredentials().add(credential.castAs(X509CertificateChainPublicCredential.class).getCertificateChain());

代码示例来源:origin: org.wildfly/wildfly-webservices-server-integration

  1. subject.getPublicCredentials().add(credential.castAs(X509CertificateChainPublicCredential.class).getCertificateChain());

代码示例来源:origin: wildfly/wildfly

  1. credential = new X509CertificateChainPrivateCredential(privateKey, certificateChain);
  2. } else if (credentialType.isAssignableFrom(X509CertificateChainPublicCredential.class)) {
  3. credential = new X509CertificateChainPublicCredential(certificateChain);
  4. } else if (credentialType.isAssignableFrom(PublicKeyCredential.class)) {
  5. credential = new PublicKeyCredential(firstCert.getPublicKey());

代码示例来源:origin: wildfly/wildfly-core

  1. subject.getPublicCredentials().add(credential.castAs(X509CertificateChainPublicCredential.class).getCertificateChain());

代码示例来源:origin: wildfly/wildfly

  1. private static IdentityCredentials getSingleCredential(Object rawCredential) {
  2. if (rawCredential == null) {
  3. return IdentityCredentials.NONE;
  4. } else if (rawCredential instanceof Credential) {
  5. return IdentityCredentials.NONE.withCredential((Credential) rawCredential);
  6. } else if (rawCredential instanceof GSSCredential) {
  7. return IdentityCredentials.NONE.withCredential(new GSSKerberosCredential((GSSCredential) rawCredential));
  8. } else if (rawCredential instanceof Password) {
  9. return IdentityCredentials.NONE.withCredential(new PasswordCredential((Password) rawCredential));
  10. } else if (rawCredential instanceof X509Certificate) {
  11. return IdentityCredentials.NONE.withCredential(new X509CertificateChainPublicCredential((X509Certificate) rawCredential));
  12. } else if (rawCredential instanceof X509Certificate[]) {
  13. return IdentityCredentials.NONE.withCredential(new X509CertificateChainPublicCredential((X509Certificate[]) rawCredential));
  14. } else if (rawCredential instanceof X500PrivateCredential) {
  15. final X500PrivateCredential credential = (X500PrivateCredential) rawCredential;
  16. return IdentityCredentials.NONE.withCredential(new X509CertificateChainPrivateCredential(credential.getPrivateKey(), credential.getCertificate()));
  17. } else if (rawCredential instanceof String) {
  18. return IdentityCredentials.NONE.withCredential(new PasswordCredential(ClearPassword.createRaw(ClearPassword.ALGORITHM_CLEAR, ((String) rawCredential).toCharArray())));
  19. } else if (rawCredential instanceof char[]) {
  20. // todo: automatically decode to other credential types
  21. return IdentityCredentials.NONE.withCredential(new PasswordCredential(ClearPassword.createRaw(ClearPassword.ALGORITHM_CLEAR, (char[]) rawCredential)));
  22. } else if (rawCredential instanceof byte[]) {
  23. // todo: automatically decode to other credential types
  24. return IdentityCredentials.NONE.withCredential(new PasswordCredential(ClearPassword.createRaw(ClearPassword.ALGORITHM_CLEAR, new String((byte[]) rawCredential, StandardCharsets.UTF_8).toCharArray())));
  25. } else {
  26. return IdentityCredentials.NONE;
  27. }
  28. }

代码示例来源:origin: wildfly/wildfly

  1. return credentialType.cast(new X509CertificateChainPublicCredential(array));
  2. } catch (ASN1Exception | CertificateException | ArrayIndexOutOfBoundsException e) {
  3. throw log.cannotAcquireCredentialFromStore(e);

代码示例来源:origin: wildfly/wildfly

  1. /**
  2. * Convert a key store entry into a credential object.
  3. *
  4. * @param keyStoreEntry the key store entry to convert (must not be {@code null})
  5. * @return the corresponding credential, or {@code null} if the entry type is unrecognized
  6. */
  7. static Credential fromKeyStoreEntry(KeyStore.Entry keyStoreEntry) {
  8. Assert.checkNotNullParam("keyStoreEntry", keyStoreEntry);
  9. if (keyStoreEntry instanceof PasswordEntry) {
  10. return new PasswordCredential(((PasswordEntry) keyStoreEntry).getPassword());
  11. } else if (keyStoreEntry instanceof KeyStore.PrivateKeyEntry) {
  12. return new X509CertificateChainPrivateCredential(((KeyStore.PrivateKeyEntry) keyStoreEntry).getPrivateKey(), X500.asX509CertificateArray(((KeyStore.PrivateKeyEntry) keyStoreEntry).getCertificateChain()));
  13. } else if (keyStoreEntry instanceof KeyStore.TrustedCertificateEntry) {
  14. return new X509CertificateChainPublicCredential((X509Certificate) ((KeyStore.TrustedCertificateEntry) keyStoreEntry).getTrustedCertificate());
  15. } else if (keyStoreEntry instanceof KeyStore.SecretKeyEntry) {
  16. return new SecretKeyCredential(((KeyStore.SecretKeyEntry) keyStoreEntry).getSecretKey());
  17. } else {
  18. return null;
  19. }
  20. }
  21. }

代码示例来源:origin: org.wildfly.security/wildfly-elytron

  1. private void parseCertificate(final List<Credential> credentials, final XMLStreamReader streamReader) throws RealmUnavailableException, XMLStreamException {
  2. parseCredential(streamReader, (algorithm, format, text) -> {
  3. if (algorithm == null) algorithm = "X.509";
  4. if (format == null) format = X509_FORMAT;
  5. try {
  6. final CertificateFactory certificateFactory = CertificateFactory.getInstance(algorithm);
  7. credentials.add(new X509CertificateChainPublicCredential((X509Certificate) certificateFactory.generateCertificate(
  8. CodePointIterator.ofString(text).base64Decode().asInputStream())));
  9. } catch (CertificateException | ClassCastException e) {
  10. throw ElytronMessages.log.fileSystemRealmCertificateReadError(format, path, streamReader.getLocation().getLineNumber(), name);
  11. }
  12. });
  13. }

代码示例来源:origin: org.jboss.eap/wildfly-client-all

  1. private void parseCertificate(final List<Credential> credentials, final XMLStreamReader streamReader) throws RealmUnavailableException, XMLStreamException {
  2. parseCredential(streamReader, (algorithm, format, text) -> {
  3. if (algorithm == null) algorithm = "X.509";
  4. if (format == null) format = X509_FORMAT;
  5. try {
  6. final CertificateFactory certificateFactory = CertificateFactory.getInstance(algorithm);
  7. credentials.add(new X509CertificateChainPublicCredential((X509Certificate) certificateFactory.generateCertificate(
  8. CodePointIterator.ofString(text).base64Decode().asInputStream())));
  9. } catch (CertificateException | ClassCastException e) {
  10. throw ElytronMessages.log.fileSystemRealmCertificateReadError(format, path, streamReader.getLocation().getLineNumber(), name);
  11. }
  12. });
  13. }

代码示例来源:origin: org.wildfly.security/wildfly-elytron-realm

  1. private void parseCertificate(final List<Credential> credentials, final XMLStreamReader streamReader) throws RealmUnavailableException, XMLStreamException {
  2. parseCredential(streamReader, (algorithm, format, text) -> {
  3. if (algorithm == null) algorithm = "X.509";
  4. if (format == null) format = X509_FORMAT;
  5. try {
  6. final CertificateFactory certificateFactory = CertificateFactory.getInstance(algorithm);
  7. credentials.add(new X509CertificateChainPublicCredential((X509Certificate) certificateFactory.generateCertificate(
  8. CodePointIterator.ofString(text).base64Decode().asInputStream())));
  9. } catch (CertificateException | ClassCastException e) {
  10. throw ElytronMessages.log.fileSystemRealmCertificateReadError(format, path, streamReader.getLocation().getLineNumber(), name);
  11. }
  12. });
  13. }

代码示例来源:origin: org.wildfly.security/wildfly-elytron-credential-source-deprecated

  1. credential = new X509CertificateChainPrivateCredential(privateKey, certificateChain);
  2. } else if (credentialType.isAssignableFrom(X509CertificateChainPublicCredential.class)) {
  3. credential = new X509CertificateChainPublicCredential(certificateChain);
  4. } else if (credentialType.isAssignableFrom(PublicKeyCredential.class)) {
  5. credential = new PublicKeyCredential(firstCert.getPublicKey());

代码示例来源:origin: org.wildfly.security/wildfly-elytron

  1. credential = new X509CertificateChainPrivateCredential(privateKey, certificateChain);
  2. } else if (credentialType.isAssignableFrom(X509CertificateChainPublicCredential.class)) {
  3. credential = new X509CertificateChainPublicCredential(certificateChain);
  4. } else if (credentialType.isAssignableFrom(PublicKeyCredential.class)) {
  5. credential = new PublicKeyCredential(firstCert.getPublicKey());

代码示例来源:origin: org.jboss.eap/wildfly-client-all

  1. credential = new X509CertificateChainPrivateCredential(privateKey, certificateChain);
  2. } else if (credentialType.isAssignableFrom(X509CertificateChainPublicCredential.class)) {
  3. credential = new X509CertificateChainPublicCredential(certificateChain);
  4. } else if (credentialType.isAssignableFrom(PublicKeyCredential.class)) {
  5. credential = new PublicKeyCredential(firstCert.getPublicKey());

代码示例来源:origin: org.jboss.eap/wildfly-webservices-server-integration

  1. publicCredentials = publicCredentials.withCredential(new PublicKeyCredential((PublicKey) credential));
  2. } else if (credential instanceof X509Certificate) {
  3. publicCredentials = publicCredentials.withCredential(new X509CertificateChainPublicCredential(
  4. (X509Certificate) credential));
  5. } else if (credential instanceof Credential) {

代码示例来源:origin: org.wildfly/wildfly-webservices-server-integration

  1. publicCredentials = publicCredentials.withCredential(new PublicKeyCredential((PublicKey) credential));
  2. } else if (credential instanceof X509Certificate) {
  3. publicCredentials = publicCredentials.withCredential(new X509CertificateChainPublicCredential(
  4. (X509Certificate) credential));
  5. } else if (credential instanceof Credential) {

代码示例来源:origin: org.jboss.eap/wildfly-client-all

  1. private static IdentityCredentials getSingleCredential(Object rawCredential) {
  2. if (rawCredential == null) {
  3. return IdentityCredentials.NONE;
  4. } else if (rawCredential instanceof Credential) {
  5. return IdentityCredentials.NONE.withCredential((Credential) rawCredential);
  6. } else if (rawCredential instanceof GSSCredential) {
  7. return IdentityCredentials.NONE.withCredential(new GSSKerberosCredential((GSSCredential) rawCredential));
  8. } else if (rawCredential instanceof Password) {
  9. return IdentityCredentials.NONE.withCredential(new PasswordCredential((Password) rawCredential));
  10. } else if (rawCredential instanceof X509Certificate) {
  11. return IdentityCredentials.NONE.withCredential(new X509CertificateChainPublicCredential((X509Certificate) rawCredential));
  12. } else if (rawCredential instanceof X509Certificate[]) {
  13. return IdentityCredentials.NONE.withCredential(new X509CertificateChainPublicCredential((X509Certificate[]) rawCredential));
  14. } else if (rawCredential instanceof X500PrivateCredential) {
  15. final X500PrivateCredential credential = (X500PrivateCredential) rawCredential;
  16. return IdentityCredentials.NONE.withCredential(new X509CertificateChainPrivateCredential(credential.getPrivateKey(), credential.getCertificate()));
  17. } else if (rawCredential instanceof String) {
  18. return IdentityCredentials.NONE.withCredential(new PasswordCredential(ClearPassword.createRaw(ClearPassword.ALGORITHM_CLEAR, ((String) rawCredential).toCharArray())));
  19. } else if (rawCredential instanceof char[]) {
  20. // todo: automatically decode to other credential types
  21. return IdentityCredentials.NONE.withCredential(new PasswordCredential(ClearPassword.createRaw(ClearPassword.ALGORITHM_CLEAR, (char[]) rawCredential)));
  22. } else if (rawCredential instanceof byte[]) {
  23. // todo: automatically decode to other credential types
  24. return IdentityCredentials.NONE.withCredential(new PasswordCredential(ClearPassword.createRaw(ClearPassword.ALGORITHM_CLEAR, new String((byte[]) rawCredential, StandardCharsets.UTF_8).toCharArray())));
  25. } else {
  26. return IdentityCredentials.NONE;
  27. }
  28. }

代码示例来源:origin: org.wildfly/wildfly-naming-client

  1. private static IdentityCredentials getSingleCredential(Object rawCredential) {
  2. if (rawCredential == null) {
  3. return IdentityCredentials.NONE;
  4. } else if (rawCredential instanceof Credential) {
  5. return IdentityCredentials.NONE.withCredential((Credential) rawCredential);
  6. } else if (rawCredential instanceof GSSCredential) {
  7. return IdentityCredentials.NONE.withCredential(new GSSKerberosCredential((GSSCredential) rawCredential));
  8. } else if (rawCredential instanceof Password) {
  9. return IdentityCredentials.NONE.withCredential(new PasswordCredential((Password) rawCredential));
  10. } else if (rawCredential instanceof X509Certificate) {
  11. return IdentityCredentials.NONE.withCredential(new X509CertificateChainPublicCredential((X509Certificate) rawCredential));
  12. } else if (rawCredential instanceof X509Certificate[]) {
  13. return IdentityCredentials.NONE.withCredential(new X509CertificateChainPublicCredential((X509Certificate[]) rawCredential));
  14. } else if (rawCredential instanceof X500PrivateCredential) {
  15. final X500PrivateCredential credential = (X500PrivateCredential) rawCredential;
  16. return IdentityCredentials.NONE.withCredential(new X509CertificateChainPrivateCredential(credential.getPrivateKey(), credential.getCertificate()));
  17. } else if (rawCredential instanceof String) {
  18. return IdentityCredentials.NONE.withCredential(new PasswordCredential(ClearPassword.createRaw(ClearPassword.ALGORITHM_CLEAR, ((String) rawCredential).toCharArray())));
  19. } else if (rawCredential instanceof char[]) {
  20. // todo: automatically decode to other credential types
  21. return IdentityCredentials.NONE.withCredential(new PasswordCredential(ClearPassword.createRaw(ClearPassword.ALGORITHM_CLEAR, (char[]) rawCredential)));
  22. } else if (rawCredential instanceof byte[]) {
  23. // todo: automatically decode to other credential types
  24. return IdentityCredentials.NONE.withCredential(new PasswordCredential(ClearPassword.createRaw(ClearPassword.ALGORITHM_CLEAR, new String((byte[]) rawCredential, StandardCharsets.UTF_8).toCharArray())));
  25. } else {
  26. return IdentityCredentials.NONE;
  27. }
  28. }

代码示例来源:origin: org.wildfly.security/wildfly-elytron-credential-store

  1. return credentialType.cast(new X509CertificateChainPublicCredential(array));
  2. } catch (ASN1Exception | CertificateException | ArrayIndexOutOfBoundsException e) {
  3. throw log.cannotAcquireCredentialFromStore(e);

代码示例来源:origin: org.wildfly.security/wildfly-elytron

  1. return credentialType.cast(new X509CertificateChainPublicCredential(array));
  2. } catch (ASN1Exception | CertificateException | ArrayIndexOutOfBoundsException e) {
  3. throw log.cannotAcquireCredentialFromStore(e);

相关文章