javax.security.cert.X509Certificate.getSubjectDN()方法的使用及代码示例

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

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

X509Certificate.getSubjectDN介绍

[英]Returns the subject (subject distinguished name) as an implementation specific Principal object.

The ASN.1 definition of subject:

subject      Name 
Name ::= CHOICE { 
RDNSequence } 
RDNSequence ::= SEQUENCE OF RelativeDistinguishedName 
RelativeDistinguishedName ::= SET OF AttributeTypeAndValue 
AttributeTypeAndValue ::= SEQUENCE { 
type     AttributeType, 
value    AttributeValue } 
AttributeType ::= OBJECT IDENTIFIER 
AttributeValue ::= ANY DEFINED BY AttributeType

[中]将主题(主题可分辨名称)作为特定于实现的主体对象返回。
ASN。1.主题的定义:

subject      Name 
Name ::= CHOICE { 
RDNSequence } 
RDNSequence ::= SEQUENCE OF RelativeDistinguishedName 
RelativeDistinguishedName ::= SET OF AttributeTypeAndValue 
AttributeTypeAndValue ::= SEQUENCE { 
type     AttributeType, 
value    AttributeValue } 
AttributeType ::= OBJECT IDENTIFIER 
AttributeValue ::= ANY DEFINED BY AttributeType

代码示例

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

@Override
public Principal getSubjectDN() {
  return unwrap().getSubjectDN();
}

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

@Override
public Principal getSubjectDN() {
  return unwrap().getSubjectDN();
}

代码示例来源:origin: eclipse-vertx/vert.x

public static String cnOf(X509Certificate cert) throws Exception {
 String dn = cert.getSubjectDN().getName();
 List<String> names = KeyStoreHelper.getX509CertificateCommonNames(dn);
 return names.isEmpty() ? null : names.get(0);
}

代码示例来源:origin: io.netty/netty-handler

@Override
public Principal getSubjectDN() {
  return unwrap().getSubjectDN();
}

代码示例来源:origin: io.vertx/vertx-core

public static String cnOf(X509Certificate cert) throws Exception {
 String dn = cert.getSubjectDN().getName();
 List<String> names = KeyStoreHelper.getX509CertificateCommonNames(dn);
 return names.isEmpty() ? null : names.get(0);
}

代码示例来源:origin: apache/activemq-artemis

protected String getDistinguishedName(final X509Certificate[] certs) {
 if (certs != null && certs.length > 0 && certs[0] != null) {
   return certs[0].getSubjectDN().getName();
 } else {
   return null;
 }
}

代码示例来源:origin: apache/activemq-artemis

@Override
public Principal getSubjectDN() {
  return unwrap().getSubjectDN();
}

代码示例来源:origin: apache/activemq-artemis

@Override
public Principal getSubjectDN() {
  return unwrap().getSubjectDN();
}

代码示例来源:origin: com.aliyun.openservices/ons-client

@Override
public Principal getSubjectDN() {
  return unwrap().getSubjectDN();
}

代码示例来源:origin: org.apache.hbase.thirdparty/hbase-shaded-netty

@Override
public Principal getSubjectDN() {
  return unwrap().getSubjectDN();
}

代码示例来源:origin: io.bitsensor/proto

@Override
public Principal getSubjectDN() {
  return unwrap().getSubjectDN();
}

代码示例来源:origin: com.couchbase.client/core-io

@Override
public Principal getSubjectDN() {
  return unwrap().getSubjectDN();
}

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

@Override
public Principal getSubjectDN() {
  return unwrap().getSubjectDN();
}

代码示例来源:origin: KostyaSha/yet-another-docker-plugin

@Override
public Principal getSubjectDN() {
  return unwrap().getSubjectDN();
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

@Override
public Principal getSubjectDN() {
  return unwrap().getSubjectDN();
}

代码示例来源:origin: org.apache.ratis/ratis-proto-shaded

@Override
public Principal getSubjectDN() {
  return unwrap().getSubjectDN();
}

代码示例来源:origin: org.eclipse.hono/hono-service-base

private void verify(final String mechanism, final byte[] saslResponse, final Handler<AsyncResult<HonoUser>> authResultHandler) {

    final JsonObject authRequest = AuthenticationConstants.getAuthenticationRequest(mechanism, saslResponse);
    if (peerCertificateChain != null) {
      authRequest.put(AuthenticationConstants.FIELD_SUBJECT_DN, peerCertificateChain[0].getSubjectDN().getName());
    }
    authenticationService.authenticate(authRequest, authResultHandler);
  }
}

代码示例来源:origin: eclipse/hono

private void verify(final String mechanism, final byte[] saslResponse, final Handler<AsyncResult<HonoUser>> authResultHandler) {

    final JsonObject authRequest = AuthenticationConstants.getAuthenticationRequest(mechanism, saslResponse);
    if (peerCertificateChain != null) {
      authRequest.put(AuthenticationConstants.FIELD_SUBJECT_DN, peerCertificateChain[0].getSubjectDN().getName());
    }
    authenticationService.authenticate(authRequest, authResultHandler);
  }
}

代码示例来源:origin: GruppoFilippetti/vertx-mqtt-broker

public String getTenant() {
  String tenant = null;
  if(certs!=null) {
    for (X509Certificate c : certs) {
      String dn = c.getSubjectDN().getName();// info del DEVICE/TENANT
      tenant = getTenantFromDN(dn);
      logger.debug("Cert Info - " + c.getSerialNumber() + " " + dn);
    }
  }
  logger.debug("Cert Info - tenant found: "+ tenant);
  return tenant;
}

代码示例来源:origin: io.vertx/vertx-codegen

public static String cnOf(X509Certificate cert) throws Exception {
 String dn = cert.getSubjectDN().getName();
 LdapName ldapDN = new LdapName(dn);
 for (Rdn rdn : ldapDN.getRdns()) {
  if (rdn.getType().equalsIgnoreCase("cn")) {
   return rdn.getValue().toString();
  }
 }
 return null;
}

相关文章