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

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

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

X509Certificate.getTBSCertificate介绍

[英]Returns the tbsCertificate information from this certificate in DER-encoded format.
[中]以DER编码格式返回此证书中的tbsCertificate信息。

代码示例

代码示例来源:origin: Meituan-Dianping/walle

@Override
public byte[] getTBSCertificate() throws CertificateEncodingException {
  return mDelegate.getTBSCertificate();
}

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

@Override
public byte[] getTBSCertificate() throws CertificateEncodingException {
  return unwrap().getTBSCertificate();
}

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

@Override
public byte[] getTBSCertificate() throws CertificateEncodingException {
  return unwrap().getTBSCertificate();
}

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

@Override
public byte[] getTBSCertificate() throws CertificateEncodingException {
  return unwrap().getTBSCertificate();
}

代码示例来源:origin: apache/pdfbox

private KeyTransRecipientInfo computeRecipientInfo(X509Certificate x509certificate, byte[] abyte0)
  throws IOException, CertificateEncodingException, InvalidKeyException,
    BadPaddingException, IllegalBlockSizeException
{
  TBSCertificate certificate;
  try (ASN1InputStream input = new ASN1InputStream(x509certificate.getTBSCertificate()))
  {
    certificate = TBSCertificate.getInstance(input.readObject());
  }
  AlgorithmIdentifier algorithmId = certificate.getSubjectPublicKeyInfo().getAlgorithm();
  IssuerAndSerialNumber serial = new IssuerAndSerialNumber(
      certificate.getIssuer(),
      certificate.getSerialNumber().getValue());
  Cipher cipher;
  try
  {
    cipher = Cipher.getInstance(algorithmId.getAlgorithm().getId(),
        SecurityProvider.getProvider());
  }
  catch (NoSuchAlgorithmException | NoSuchPaddingException e)
  {
    // should never happen, if this happens throw IOException instead
    throw new RuntimeException("Could not find a suitable javax.crypto provider", e);
  }
  cipher.init(1, x509certificate.getPublicKey());
  DEROctetString octets = new DEROctetString(cipher.doFinal(abyte0));
  RecipientIdentifier recipientId = new RecipientIdentifier(serial);
  return new KeyTransRecipientInfo(recipientId, algorithmId, octets);
}

代码示例来源:origin: org.nhind/agent

@Override
/**
 * {@inheritDoc}
 */
public byte[] getTBSCertificate() throws CertificateEncodingException
{
  return internalCert.getTBSCertificate();
}

代码示例来源:origin: org.wildfly/wildfly-testsuite-shared

private static void createTemporaryCertFile(X509Certificate cert, File outputFile) throws Exception {
  try (FileOutputStream fos = new FileOutputStream(outputFile)){
    fos.write(cert.getTBSCertificate());
  }
}

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

private static void createTemporaryCertFile(X509Certificate cert, File outputFile) throws Exception {
  try (FileOutputStream fos = new FileOutputStream(outputFile)){
    fos.write(cert.getTBSCertificate());
  }
}

代码示例来源:origin: stackoverflow.com

URL url = new URL("https://www.google.com/");
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
con.connect();
Certificate userCert[] = con.getServerCertificates();
    X509Certificate x509cert = ((X509Certificate) userCert[0]);

    byte[] tbs=x509cert.getTBSCertificate();

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

@Override
public byte[] getTBSCertificate() throws CertificateEncodingException {
  return unwrap().getTBSCertificate();
}

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

@Override
public byte[] getTBSCertificate() throws CertificateEncodingException {
  return unwrap().getTBSCertificate();
}

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

@Override
public byte[] getTBSCertificate() throws CertificateEncodingException {
  return unwrap().getTBSCertificate();
}

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

@Override
public byte[] getTBSCertificate() throws CertificateEncodingException {
  return unwrap().getTBSCertificate();
}

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

@Override
public byte[] getTBSCertificate() throws CertificateEncodingException {
  return unwrap().getTBSCertificate();
}

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

@Override
public byte[] getTBSCertificate() throws CertificateEncodingException {
  return unwrap().getTBSCertificate();
}

代码示例来源:origin: org.wildfly.openssl/wildfly-openssl-java

@Override
public byte[] getTBSCertificate() throws CertificateEncodingException {
  return unwrap().getTBSCertificate();
}

代码示例来源:origin: com.itextpdf/itextpdf

/**
 * Get the issuer fields from an X509 Certificate
 * @param cert an X509Certificate
 * @return an X500Name
 */
public static X500Name getIssuerFields(X509Certificate cert) {
  try {
    return new X500Name((ASN1Sequence)CertificateInfo.getIssuer(cert.getTBSCertificate()));
  }
  catch (Exception e) {
    throw new ExceptionConverter(e);
  }
}

代码示例来源:origin: es.gob.afirma/afirma-crypto-pdf-itext

/**
 * Get the subject fields from an X509 Certificate
 * @param cert an X509Certificate
 * @return an X509Name
 */
public static X509Name getSubjectFields(final X509Certificate cert) {
  try {
    return new X509Name((ASN1Sequence)getSubject(cert.getTBSCertificate()));
  }
  catch (final Exception e) {
    throw new ExceptionConverter(e);
  }
}

代码示例来源:origin: fr.opensagres.xdocreport.itext-gae/itext-gae

/**
 * Get the issuer fields from an X509 Certificate
 * @param cert an X509Certificate
 * @return an X509Name
 */
public static X509Name getIssuerFields(X509Certificate cert) {
  try {
    return new X509Name((ASN1Sequence)getIssuer(cert.getTBSCertificate()));
  }
  catch (Exception e) {
    throw new ExceptionConverter(e);
  }
}

代码示例来源:origin: DirectProject/nhin-d

public void testGetObject_validObjectEncoding() throws Exception
{
  // load cert
  final X509Certificate cert = TestUtils.loadCertificate("CernerDirect DevCert Provider CA.der");
  
  // use a concreate class and check for key usage
  final SignatureAlgorithmField field = new SignatureAlgorithmField();
  assertNotNull(field.getDERObject(cert.getTBSCertificate()));
}

相关文章