org.apache.harmony.security.provider.cert.X509CertImpl.<init>()方法的使用及代码示例

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

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

X509CertImpl.<init>介绍

[英]Constructs the instance on the base of ASN.1 encoded form of X.509 certificate provided via stream parameter.
[中]在ASN的基础上构造实例。1通过流参数提供的X.509证书的编码形式。

代码示例

代码示例来源: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

/**
 * Extract a CertPath from a PKCS#7 {@code contentInfo} object.
 */
private static X509CertPathImpl getCertPathFromContentInfo(ContentInfo contentInfo)
    throws CertificateException {
  final SignedData sd = contentInfo.getSignedData();
  if (sd == null) {
    throw new CertificateException("Incorrect PKCS7 encoded form: missing signed data");
  }
  List<Certificate> certs = sd.getCertificates();
  if (certs == null) {
    certs = Collections.emptyList();
  }
  final List<X509Certificate> result = new ArrayList<X509Certificate>(certs.size());
  for (Certificate cert : certs) {
    result.add(new X509CertImpl(cert));
  }
  return new X509CertPathImpl(result, Encoding.PKCS7);
}

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

return res;
  res = new X509CertImpl(encoding);
  CERT_CACHE.put(hash, encoding, res);
  return res;
} else {
  inStream.reset();
  Certificate res = new X509CertImpl(inStream);
  CERT_CACHE.put(hash, res.getEncoded(), res);
  return res;

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

/**
 * Returns the Certificate object corresponding to the provided encoding.
 * Resulting object is retrieved from the cache
 * if it contains such correspondence
 * and is constructed on the base of encoding
 * and stored in the cache otherwise.
 * @throws IOException if some decoding errors occur
 * (in the case of cache miss).
 */
private static Certificate getCertificate(byte[] encoding)
                throws CertificateException, IOException {
  if (encoding.length < CERT_CACHE_SEED_LENGTH) {
    throw new CertificateException("encoding.length < CERT_CACHE_SEED_LENGTH");
  }
  synchronized (CERT_CACHE) {
    long hash = CERT_CACHE.getHash(encoding);
    if (CERT_CACHE.contains(hash)) {
      Certificate res =
        (Certificate) CERT_CACHE.get(hash, encoding);
      if (res != null) {
        return res;
      }
    }
    Certificate res = new X509CertImpl(encoding);
    CERT_CACHE.put(hash, encoding, res);
    return res;
  }
}

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

if (certs != null) {
  for (org.apache.harmony.security.x509.Certificate cert : certs) {
    result.add(new X509CertImpl(cert));

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

int i = 0;
for (org.apache.harmony.security.x509.Certificate encCert : encCerts) {
  certs[i++] = new X509CertImpl(encCert);

代码示例来源:origin: MobiVM/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: ibinti/bugvm

/**
 * 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: com.bugvm/bugvm-rt

/**
 * 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: FlexoVM/flexovm

/**
 * 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: com.mobidevelop.robovm/robovm-rt

/**
 * 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: com.gluonhq/robovm-rt

/**
 * 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: MobiVM/robovm

/**
 * Extract a CertPath from a PKCS#7 {@code contentInfo} object.
 */
private static X509CertPathImpl getCertPathFromContentInfo(ContentInfo contentInfo)
    throws CertificateException {
  final SignedData sd = contentInfo.getSignedData();
  if (sd == null) {
    throw new CertificateException("Incorrect PKCS7 encoded form: missing signed data");
  }
  List<Certificate> certs = sd.getCertificates();
  if (certs == null) {
    certs = Collections.emptyList();
  }
  final List<X509Certificate> result = new ArrayList<X509Certificate>(certs.size());
  for (Certificate cert : certs) {
    result.add(new X509CertImpl(cert));
  }
  return new X509CertPathImpl(result, Encoding.PKCS7);
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Extract a CertPath from a PKCS#7 {@code contentInfo} object.
 */
private static X509CertPathImpl getCertPathFromContentInfo(ContentInfo contentInfo)
    throws CertificateException {
  final SignedData sd = contentInfo.getSignedData();
  if (sd == null) {
    throw new CertificateException("Incorrect PKCS7 encoded form: missing signed data");
  }
  List<Certificate> certs = sd.getCertificates();
  if (certs == null) {
    certs = Collections.emptyList();
  }
  final List<X509Certificate> result = new ArrayList<X509Certificate>(certs.size());
  for (Certificate cert : certs) {
    result.add(new X509CertImpl(cert));
  }
  return new X509CertPathImpl(result, Encoding.PKCS7);
}

代码示例来源:origin: ibinti/bugvm

/**
 * Extract a CertPath from a PKCS#7 {@code contentInfo} object.
 */
private static X509CertPathImpl getCertPathFromContentInfo(ContentInfo contentInfo)
    throws CertificateException {
  final SignedData sd = contentInfo.getSignedData();
  if (sd == null) {
    throw new CertificateException("Incorrect PKCS7 encoded form: missing signed data");
  }
  List<Certificate> certs = sd.getCertificates();
  if (certs == null) {
    certs = Collections.emptyList();
  }
  final List<X509Certificate> result = new ArrayList<X509Certificate>(certs.size());
  for (Certificate cert : certs) {
    result.add(new X509CertImpl(cert));
  }
  return new X509CertPathImpl(result, Encoding.PKCS7);
}

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

/**
 * Extract a CertPath from a PKCS#7 {@code contentInfo} object.
 */
private static X509CertPathImpl getCertPathFromContentInfo(ContentInfo contentInfo)
    throws CertificateException {
  final SignedData sd = contentInfo.getSignedData();
  if (sd == null) {
    throw new CertificateException("Incorrect PKCS7 encoded form: missing signed data");
  }
  List<Certificate> certs = sd.getCertificates();
  if (certs == null) {
    certs = Collections.emptyList();
  }
  final List<X509Certificate> result = new ArrayList<X509Certificate>(certs.size());
  for (Certificate cert : certs) {
    result.add(new X509CertImpl(cert));
  }
  return new X509CertPathImpl(result, Encoding.PKCS7);
}

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

/**
 * Extract a CertPath from a PKCS#7 {@code contentInfo} object.
 */
private static X509CertPathImpl getCertPathFromContentInfo(ContentInfo contentInfo)
    throws CertificateException {
  final SignedData sd = contentInfo.getSignedData();
  if (sd == null) {
    throw new CertificateException("Incorrect PKCS7 encoded form: missing signed data");
  }
  List<Certificate> certs = sd.getCertificates();
  if (certs == null) {
    certs = Collections.emptyList();
  }
  final List<X509Certificate> result = new ArrayList<X509Certificate>(certs.size());
  for (Certificate cert : certs) {
    result.add(new X509CertImpl(cert));
  }
  return new X509CertPathImpl(result, Encoding.PKCS7);
}

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

/**
 * Extract a CertPath from a PKCS#7 {@code contentInfo} object.
 */
private static X509CertPathImpl getCertPathFromContentInfo(ContentInfo contentInfo)
    throws CertificateException {
  final SignedData sd = contentInfo.getSignedData();
  if (sd == null) {
    throw new CertificateException("Incorrect PKCS7 encoded form: missing signed data");
  }
  List<Certificate> certs = sd.getCertificates();
  if (certs == null) {
    certs = Collections.emptyList();
  }
  final List<X509Certificate> result = new ArrayList<X509Certificate>(certs.size());
  for (Certificate cert : certs) {
    result.add(new X509CertImpl(cert));
  }
  return new X509CertPathImpl(result, Encoding.PKCS7);
}

代码示例来源:origin: ibinti/bugvm

/**
 * Returns the Certificate object corresponding to the provided encoding.
 * Resulting object is retrieved from the cache
 * if it contains such correspondence
 * and is constructed on the base of encoding
 * and stored in the cache otherwise.
 * @throws IOException if some decoding errors occur
 * (in the case of cache miss).
 */
private static Certificate getCertificate(byte[] encoding)
                throws CertificateException, IOException {
  if (encoding.length < CERT_CACHE_SEED_LENGTH) {
    throw new CertificateException("encoding.length < CERT_CACHE_SEED_LENGTH");
  }
  synchronized (CERT_CACHE) {
    long hash = CERT_CACHE.getHash(encoding);
    if (CERT_CACHE.contains(hash)) {
      Certificate res =
        (Certificate) CERT_CACHE.get(hash, encoding);
      if (res != null) {
        return res;
      }
    }
    Certificate res = new X509CertImpl(encoding);
    CERT_CACHE.put(hash, encoding, res);
    return res;
  }
}

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

/**
 * Returns the Certificate object corresponding to the provided encoding.
 * Resulting object is retrieved from the cache
 * if it contains such correspondence
 * and is constructed on the base of encoding
 * and stored in the cache otherwise.
 * @throws IOException if some decoding errors occur
 * (in the case of cache miss).
 */
private static Certificate getCertificate(byte[] encoding)
                throws CertificateException, IOException {
  if (encoding.length < CERT_CACHE_SEED_LENGTH) {
    throw new CertificateException("encoding.length < CERT_CACHE_SEED_LENGTH");
  }
  synchronized (CERT_CACHE) {
    long hash = CERT_CACHE.getHash(encoding);
    if (CERT_CACHE.contains(hash)) {
      Certificate res =
        (Certificate) CERT_CACHE.get(hash, encoding);
      if (res != null) {
        return res;
      }
    }
    Certificate res = new X509CertImpl(encoding);
    CERT_CACHE.put(hash, encoding, res);
    return res;
  }
}

相关文章