Methods Summary |
---|
public java.util.List | getCertificates()
return Collections.unmodifiableList(certificates);
|
public byte[] | getEncoded()
if (pkiPathEncoding == null) {
pkiPathEncoding = ASN1.encode(this);
}
byte[] result = new byte[pkiPathEncoding.length];
System.arraycopy(pkiPathEncoding, 0, result, 0, pkiPathEncoding.length);
return result;
|
public byte[] | getEncoded(java.lang.String encoding)
if (!encodings.contains(encoding)) {
throw new CertificateEncodingException(
Messages.getString("security.15F", encoding)); //$NON-NLS-1$
}
if (encodingsArr[0].equals(encoding)) {
// PkiPath encoded form
return getEncoded();
} else {
// PKCS7 encoded form
if (pkcs7Encoding == null) {
pkcs7Encoding = PKCS7_SIGNED_DATA_OBJECT.encode(this);
}
byte[] result = new byte[pkcs7Encoding.length];
System.arraycopy(pkcs7Encoding, 0, result, 0,
pkcs7Encoding.length);
return result;
}
|
public java.util.Iterator | getEncodings()
return encodings.iterator();
|
public static org.apache.harmony.security.provider.cert.X509CertPathImpl | getInstance(java.io.InputStream in)Generates certification path object on the base of PkiPath
encoded form provided via input stream.
try {
return (X509CertPathImpl) ASN1.decode(in);
} catch (IOException e) {
throw new CertificateException(Messages.getString("security.15E", //$NON-NLS-1$
e.getMessage()));
}
|
public static org.apache.harmony.security.provider.cert.X509CertPathImpl | getInstance(java.io.InputStream in, java.lang.String encoding)Generates certification path object on the base of encoding provided via
input stream. The format of provided encoded form is specified by
parameter encoding .
if (!encodings.contains(encoding)) {
throw new CertificateException(
Messages.getString("security.15F", encoding)); //$NON-NLS-1$
}
try {
if (encodingsArr[0].equals(encoding)) {
// generate the object from PkiPath encoded form
return (X509CertPathImpl) ASN1.decode(in);
} else {
// generate the object from PKCS #7 encoded form
ContentInfo ci = (ContentInfo) ContentInfo.ASN1.decode(in);
SignedData sd = ci.getSignedData();
if (sd == null) {
throw new CertificateException(
Messages.getString("security.160")); //$NON-NLS-1$
}
List certs = sd.getCertificates();
if (certs == null) {
// empty chain of certificates
certs = new ArrayList();
}
List result = new ArrayList();
for (int i=0; i<certs.size(); i++) {
result.add(new X509CertImpl((Certificate) certs.get(i)));
}
return new X509CertPathImpl(result, PKCS7, ci.getEncoded());
}
} catch (IOException e) {
throw new CertificateException(Messages.getString("security.15E", //$NON-NLS-1$
e.getMessage()));
}
|
public static org.apache.harmony.security.provider.cert.X509CertPathImpl | getInstance(byte[] in)Generates certification path object on the base of PkiPath
encoded form provided via array of bytes.
try {
return (X509CertPathImpl) ASN1.decode(in);
} catch (IOException e) {
throw new CertificateException(Messages.getString("security.15E", //$NON-NLS-1$
e.getMessage()));
}
|
public static org.apache.harmony.security.provider.cert.X509CertPathImpl | getInstance(byte[] in, java.lang.String encoding)Generates certification path object on the base of encoding provided via
array of bytes. The format of provided encoded form is specified by
parameter encoding .
if (!encodings.contains(encoding)) {
throw new CertificateException(
Messages.getString("security.15F", encoding)); //$NON-NLS-1$
}
try {
if (encodingsArr[0].equals(encoding)) {
// generate the object from PkiPath encoded form
return (X509CertPathImpl) ASN1.decode(in);
} else {
// generate the object from PKCS #7 encoded form
ContentInfo ci = (ContentInfo) ContentInfo.ASN1.decode(in);
SignedData sd = ci.getSignedData();
if (sd == null) {
throw new CertificateException(
Messages.getString("security.160")); //$NON-NLS-1$
}
List certs = sd.getCertificates();
if (certs == null) {
certs = new ArrayList();
}
List result = new ArrayList();
for (int i=0; i<certs.size(); i++) {
result.add(new X509CertImpl((Certificate) certs.get(i)));
}
return new X509CertPathImpl(result, PKCS7, ci.getEncoded());
}
} catch (IOException e) {
throw new CertificateException(Messages.getString("security.15E", //$NON-NLS-1$
e.getMessage()));
}
|