org.bouncycastle.asn1.x500.X500Name.getEncoded()方法的使用及代码示例

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

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

X500Name.getEncoded介绍

暂无

代码示例

代码示例来源:origin: org.xwiki.commons/xwiki-commons-crypto-pkix

@Override
public byte[] getEncoded() throws IOException
{
  return this.dn.getEncoded();
}

代码示例来源:origin: kaikramer/keystore-explorer

/**
 * Convert an X.500 Name to an X.500 Principal.
 *
 * @param name
 *            X.500 Name
 * @return X.500 Principal
 * @throws IOException if an encoding error occurs (incorrect form for DN)
 */
public static X500Principal x500NameToX500Principal(X500Name name) throws IOException {
  return new X500Principal(name.getEncoded());
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public X500Principal getCertificateIssuer()
{
  if (certificateIssuer == null)
  {
    return null;
  }
  try
  {
    return new X500Principal(certificateIssuer.getEncoded());
  }
  catch (IOException e)
  {
    return null;
  }
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public X500Principal getCertificateIssuer()
{
  if (certificateIssuer == null)
  {
    return null;
  }
  try
  {
    return new X500Principal(certificateIssuer.getEncoded());
  }
  catch (IOException e)
  {
    return null;
  }
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public X500Principal getIssuerX500Principal()
{
  try
  {
    return new X500Principal(c.getIssuer().getEncoded());
  }
  catch (IOException e)
  {
    throw new IllegalStateException("can't encode issuer DN");
  }
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public X500Principal getIssuerX500Principal()
{
  try
  {
    return new X500Principal(c.getIssuer().getEncoded());
  }
  catch (IOException e)
  {
    throw new IllegalStateException("can't encode issuer DN");
  }
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public Principal getIssuerDN()
{
  try
  {
    return new X509Principal(X500Name.getInstance(c.getIssuer().getEncoded()));
  }
  catch (IOException e)
  {
    return null;
  }
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public Principal getIssuerDN()
{
  try
  {
    return new X509Principal(X500Name.getInstance(c.getIssuer().getEncoded()));
  }
  catch (IOException e)
  {
    return null;
  }
}

代码示例来源:origin: org.xipki/ca-api

public PublicCaInfo(X500Name subject, BigInteger serialNumber, GeneralNames subjectAltName,
  byte[] subjectKeyIdentifier, CaUris caUris, ConfPairs extraControl)
  throws OperationException {
 this.x500Subject = Args.notNull(subject, "subject");
 this.serialNumber = Args.notNull(serialNumber, "serialNumber");
 this.caUris = (caUris == null) ? CaUris.EMPTY_INSTANCE : caUris;
 this.caCert = null;
 this.c14nSubject = X509Util.canonicalizName(subject);
 try {
  this.subject = new X500Principal(subject.getEncoded());
 } catch (IOException ex) {
  throw new OperationException(ErrorCode.SYSTEM_FAILURE,
    "invalid SubjectAltName extension in CA certificate");
 }
 this.subjectKeyIdentifier = (subjectKeyIdentifier == null) ? null
   : Arrays.copyOf(subjectKeyIdentifier, subjectKeyIdentifier.length);
 this.subjectAltName = subjectAltName;
 this.extraControl = extraControl;
} // constructor

代码示例来源:origin: redfish64/TinyTravelTracker

byte[] derEncoding = certificateAuthority.getEncoded(ASN1Encoding.DER);
derEncodings.addElement(derEncoding);
totalLength += derEncoding.length + 2;

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

byte[] derEncoding = certificateAuthority.getEncoded(ASN1Encoding.DER);
derEncodings.addElement(derEncoding);
totalLength += derEncoding.length + 2;

代码示例来源:origin: eu.eu-emi.security/canl

/**
   * Constructs a {@link X500Principal} object from a RFC 2253 string. This
   * method can handle DNs with attributes not supported by the {@link X500Principal}
   * constructor.    
   * @param rfcDn RFC 2253 DN
   * @return the created object
   * @throws IOException IO exception
   */
  public static X500Principal getX500Principal(String rfcDn) throws IOException
  {
    JavaAndBCStyle style = new JavaAndBCStyle();
    X500Name x500Name = new X500Name(style, rfcDn);
    RDN[] rdns = x500Name.getRDNs();
    for (int i=0; i<rdns.length/2; i++)
    {
      RDN bak = rdns[i];
      rdns[i] = rdns[rdns.length-1-i];
      rdns[rdns.length-1-i] = bak;
    }
    X500Name x500Name2 = new X500Name(rdns);
    byte []encoded = x500Name2.getEncoded(ASN1Encoding.DER);
    return new X500Principal(encoded);
  }
}

代码示例来源:origin: com.yahoo.vespa/security-utils

public static X509CertificateBuilder fromCsr(Pkcs10Csr csr,
                       X500Principal caIssuer,
                       Instant notBefore,
                       Instant notAfter,
                       PrivateKey caPrivateKey,
                       SignatureAlgorithm signingAlgorithm,
                       BigInteger serialNumber) {
  try {
    PKCS10CertificationRequest bcCsr = csr.getBcCsr();
    PublicKey publicKey = new JcaPKCS10CertificationRequest(bcCsr)
        .setProvider(BouncyCastleProviderHolder.getInstance())
        .getPublicKey();
    return new X509CertificateBuilder(caIssuer,
                     new X500Principal(bcCsr.getSubject().getEncoded()),
                     notBefore,
                     notAfter,
                     publicKey,
                     caPrivateKey,
                     signingAlgorithm,
                     serialNumber);
  } catch (GeneralSecurityException e) {
    throw new RuntimeException(e);
  } catch (IOException e) {
    throw new UncheckedIOException(e);
  }
}

代码示例来源:origin: eu.eu-emi.security/canl

private String getLastCN() throws IllegalArgumentException, IOException
{
  byte[] subject = csr.getSubject().getEncoded(ASN1Encoding.DER);
  X500Name withDefaultStyle = X500Name.getInstance(subject);
  JavaAndBCStyle style = new JavaAndBCStyle();
  return ProxyHelper.getLastCN(X500Name.getInstance(style, withDefaultStyle));
}

代码示例来源:origin: org.xipki/security

public IssuerHash(HashAlgo hashAlgo, Certificate issuerCert) throws IOException {
 this.hashAlgo = Args.notNull(hashAlgo, "hashAlgo");
 Args.notNull(issuerCert, "issuerCert");
 byte[] encodedName = issuerCert.getSubject().getEncoded();
 byte[] encodedKey = issuerCert.getSubjectPublicKeyInfo().getPublicKeyData().getBytes();
 this.issuerNameHash = HashCalculator.hash(hashAlgo, encodedName);
 this.issuerKeyHash = HashCalculator.hash(hashAlgo, encodedKey);
}

代码示例来源:origin: org.xipki.tk/security

public IssuerHash(final HashAlgoType hashAlgo, final Certificate issuerCert)
    throws IOException {
  this.hashAlgo = ParamUtil.requireNonNull("hashAlgo", hashAlgo);
  ParamUtil.requireNonNull("issuerCert", issuerCert);
  byte[] encodedName = issuerCert.getSubject().getEncoded();
  byte[] encodedKey = issuerCert.getSubjectPublicKeyInfo().getPublicKeyData().getBytes();
  this.issuerNameHash = HashCalculator.hash(hashAlgo, encodedName);
  this.issuerKeyHash = HashCalculator.hash(hashAlgo, encodedKey);
}

代码示例来源:origin: org.xipki/ca-mgmt-client

@Override
public CertWithRevocationInfo getCert(X500Name issuer, BigInteger serialNumber)
  throws CaMgmtException {
 MgmtRequest.GetCert req = new MgmtRequest.GetCert();
 try {
  req.setEncodedIssuerDn(issuer.getEncoded());
 } catch (IOException ex) {
  throw new CaMgmtException("could not encode issuer", ex);
 }
 req.setSerialNumber(serialNumber);
 byte[] respBytes = transmit(MgmtAction.getCert, req);
 MgmtResponse.GetCert resp = parse(respBytes, MgmtResponse.GetCert.class);
 try {
  return resp.getResult().toCertWithRevocationInfo();
 } catch (CertificateException ex) {
  throw new CaMgmtException("could not parse the certificate", ex);
 }
}

代码示例来源:origin: org.xipki/ca-mgmt-client

@Override
public List<CertListInfo> listCertificates(String caName, X500Name subjectPattern, Date validFrom,
  Date validTo, CertListOrderBy orderBy, int numEntries) throws CaMgmtException {
 MgmtRequest.ListCertificates req = new MgmtRequest.ListCertificates();
 req.setCaName(caName);
 if (subjectPattern != null) {
  try {
   req.setEncodedSubjectDnPattern(subjectPattern.getEncoded());
  } catch (IOException ex) {
   throw new CaMgmtException("could not parse subjectPattern", ex);
  }
 }
 req.setValidFrom(validFrom);
 req.setValidTo(validTo);
 req.setOrderBy(orderBy);
 req.setNumEntries(numEntries);
 byte[] respBytes = transmit(MgmtAction.listCertificates, req);
 MgmtResponse.ListCertificates resp = parse(respBytes, MgmtResponse.ListCertificates.class);
 return resp.getResult();
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

crlselect.addIssuerName(PrincipalUtils.getIssuerPrincipal(crl).getEncoded());

代码示例来源:origin: eu.eu-emi.security/canl

crlselect.addIssuerName(PrincipalUtils.getIssuerPrincipal(crl).getEncoded());

相关文章