gpt4 book ai didi

org.apache.harmony.security.provider.cert.X509CertImpl类的使用及代码示例

转载 作者:知者 更新时间:2024-03-24 16:47:05 25 4
gpt4 key购买 nike

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

X509CertImpl介绍

[英]This class is an implementation of X509Certificate. It wraps the instance of org.apache.harmony.security.x509.Certificate built on the base of provided ASN.1 DER encoded form of Certificate structure (as specified in RFC 3280 http://www.ietf.org/rfc/rfc3280.txt).
[中]此类是X509Certificate的实现。它包装了org的实例。阿帕奇。融洽安全x509。基于提供的ASN建立的证书。1.证书结构的DER编码形式(如RFC 3280中规定http://www.ietf.org/rfc/rfc3280.txt).

代码示例

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

public void checkValidity(Date date)
    throws CertificateExpiredException, CertificateNotYetValidException {
  checkValidity(date.getTime());
}

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

/**
 * Builds the instance of X509CertPathImpl on the base of the list of
 * ASN.1 encodings of X.509 certificates provided via PkiPath structure.
 * This method participates in decoding process.
 */
public Object getDecodedObject(BerInputStream in) throws IOException {
  // retrieve the decoded content
  final List<byte[]> encodedCerts = (List<byte[]>) in.content;
  final int size = encodedCerts.size();
  final List<X509Certificate> certificates = new ArrayList<X509Certificate>(size);
  for (int i = size - 1; i >= 0; i--) {
    // create the X.509 certificate on the base of its encoded form
    // and add it to the list.
    certificates.add(new X509CertImpl((Certificate) Certificate.ASN1
        .decode(encodedCerts.get(i))));
  }
  // create and return the resulting object
  return new X509CertPathImpl(certificates, Encoding.PKI_PATH);
}

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

@Override public byte[] getEncoded() throws CertificateEncodingException {
  return getEncodedInternal().clone();
}
private byte[] getEncodedInternal() throws CertificateEncodingException {

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

private void checkValidity(long time)
    throws CertificateExpiredException, CertificateNotYetValidException {
  if (time < getNotBeforeInternal()) {
    throw new CertificateNotYetValidException("current time: " + new Date(time)
      + ", validation time: " + new Date(getNotBeforeInternal()));
  }
  if (time > getNotAfterInternal()) {
    throw new CertificateExpiredException("current time: " + new Date(time)
      + ", expiration time: " + new Date(getNotAfterInternal()));
  }
}

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

@Override public void verify(PublicKey key, String sigProvider)
    throws CertificateException, NoSuchAlgorithmException, InvalidKeyException,
    NoSuchProviderException, SignatureException {
  Signature signature = Signature.getInstance(getSigAlgName(), sigProvider);
  signature.initVerify(key);
  // retrieve the encoding of the TBSCertificate structure
  byte[] tbsCertificateLocal = getTbsCertificateInternal();
  // compute and verify the signature
  signature.update(tbsCertificateLocal, 0, tbsCertificateLocal.length);
  if (!signature.verify(certificate.getSignatureValue())) {
    throw new SignatureException("Signature was not verified");
  }
}

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

public Date getNotAfter() {
  return new Date(getNotAfterInternal());
}

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

public Date getNotBefore() {
  return new Date(getNotBeforeInternal());
}

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

public String getSigAlgName() {
  String result = sigAlgName;
  if (result == null) {
    String sigAlgOIDLocal = getSigAlgOID();
    // retrieve the name of the signing algorithm
    result = AlgNameMapper.map2AlgName(sigAlgOIDLocal);
    if (result == null) {
      // if could not be found, use OID as a name
      result = sigAlgOIDLocal;
    }
    sigAlgName = result;
  }
  return result;
}

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

public Principal getIssuerDN() {
  return getIssuerX500Principal();
}

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

public Principal getSubjectDN() {
  return getSubjectX500Principal();
}

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

public byte[] getSignature() {
  return getSignatureInternal().clone();
}

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

@Override public void verify(PublicKey key)
    throws CertificateException, NoSuchAlgorithmException, InvalidKeyException,
    NoSuchProviderException, SignatureException {
  Signature signature = Signature.getInstance(getSigAlgName());
  signature.initVerify(key);
  // retrieve the encoding of the TBSCertificate structure
  byte[] tbsCertificateLocal = getTbsCertificateInternal();
  // compute and verify the signature
  signature.update(tbsCertificateLocal, 0, tbsCertificateLocal.length);
  if (!signature.verify(certificate.getSignatureValue())) {
    throw new SignatureException("Signature was not verified");
  }
}

代码示例来源:origin: MobiVM/robovm

private void checkValidity(long time)
    throws CertificateExpiredException, CertificateNotYetValidException {
  if (time < getNotBeforeInternal()) {
    throw new CertificateNotYetValidException("current time: " + new Date(time)
      + ", validation time: " + new Date(getNotBeforeInternal()));
  }
  if (time > getNotAfterInternal()) {
    throw new CertificateExpiredException("current time: " + new Date(time)
      + ", expiration time: " + new Date(getNotAfterInternal()));
  }
}

代码示例来源:origin: MobiVM/robovm

public Date getNotAfter() {
  return new Date(getNotAfterInternal());
}

代码示例来源:origin: MobiVM/robovm

public Date getNotBefore() {
  return new Date(getNotBeforeInternal());
}

代码示例来源:origin: MobiVM/robovm

public String getSigAlgName() {
  String result = sigAlgName;
  if (result == null) {
    String sigAlgOIDLocal = getSigAlgOID();
    // retrieve the name of the signing algorithm
    result = AlgNameMapper.map2AlgName(sigAlgOIDLocal);
    if (result == null) {
      // if could not be found, use OID as a name
      result = sigAlgOIDLocal;
    }
    sigAlgName = result;
  }
  return result;
}

代码示例来源:origin: MobiVM/robovm

public Principal getIssuerDN() {
  return getIssuerX500Principal();
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

public Principal getSubjectDN() {
  return getSubjectX500Principal();
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

public byte[] getSignature() {
  return getSignatureInternal().clone();
}

代码示例来源:origin: MobiVM/robovm

@Override public void verify(PublicKey key, String sigProvider)
    throws CertificateException, NoSuchAlgorithmException, InvalidKeyException,
    NoSuchProviderException, SignatureException {
  Signature signature = Signature.getInstance(getSigAlgName(), sigProvider);
  signature.initVerify(key);
  // retrieve the encoding of the TBSCertificate structure
  byte[] tbsCertificateLocal = getTbsCertificateInternal();
  // compute and verify the signature
  signature.update(tbsCertificateLocal, 0, tbsCertificateLocal.length);
  if (!signature.verify(certificate.getSignatureValue())) {
    throw new SignatureException("Signature was not verified");
  }
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com