use of com.github.zhenwei.core.asn1.ASN1InputStream in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class CertInstallerHelper method isCa.
private boolean isCa(X509Certificate cert) {
try {
byte[] asn1EncodedBytes = cert.getExtensionValue("2.5.29.19");
if (asn1EncodedBytes == null) {
return false;
}
DEROctetString derOctetString = (DEROctetString) new ASN1InputStream(asn1EncodedBytes).readObject();
byte[] octets = derOctetString.getOctets();
ASN1Sequence sequence = (ASN1Sequence) new ASN1InputStream(octets).readObject();
return BasicConstraints.getInstance(sequence).isCA();
} catch (IOException e) {
return false;
}
}
use of com.github.zhenwei.core.asn1.ASN1InputStream in project nhin-d by DirectProject.
the class TrustChainValidator method getObject.
private DERObject getObject(byte[] ext) {
ASN1InputStream aIn = null;
try {
aIn = new ASN1InputStream(ext);
ASN1OctetString octs = (ASN1OctetString) aIn.readObject();
IOUtils.closeQuietly(aIn);
aIn = new ASN1InputStream(octs.getOctets());
return aIn.readObject();
} catch (Exception e) {
throw new IllegalArgumentException("Exception processing data ", e);
} finally {
IOUtils.closeQuietly(aIn);
}
}
use of com.github.zhenwei.core.asn1.ASN1InputStream in project nhin-d by DirectProject.
the class MessageSigInspector method getObject.
protected static DERObject getObject(byte[] ext) throws PolicyProcessException {
ASN1InputStream aIn = null;
try {
aIn = new ASN1InputStream(ext);
ASN1OctetString octs = (ASN1OctetString) aIn.readObject();
IOUtils.closeQuietly(aIn);
aIn = new ASN1InputStream(octs.getOctets());
return aIn.readObject();
} catch (Exception e) {
throw new PolicyProcessException("Exception processing data ", e);
} finally {
IOUtils.closeQuietly(aIn);
}
}
use of com.github.zhenwei.core.asn1.ASN1InputStream in project nhin-d by DirectProject.
the class AbstractX509Field method getObject.
/**
* Converts an encoded internal octet string object to a DERObject
* @param ext The encoded octet string as a byte array
* @return The converted DERObject
* @throws PolicyProcessException
*/
protected DERObject getObject(byte[] ext) throws PolicyProcessException {
ASN1InputStream aIn = null;
try {
aIn = new ASN1InputStream(ext);
ASN1OctetString octs = (ASN1OctetString) aIn.readObject();
IOUtils.closeQuietly(aIn);
aIn = new ASN1InputStream(octs.getOctets());
return aIn.readObject();
} catch (Exception e) {
throw new PolicyProcessException("Exception processing data ", e);
} finally {
IOUtils.closeQuietly(aIn);
}
}
use of com.github.zhenwei.core.asn1.ASN1InputStream in project nhin-d by DirectProject.
the class AbstractX509Field method getDERObject.
/**
* Converts an encoded internal sequence object to a DERObject
* @param ext The encoded sequence as a byte array
* @return The converted DERObject
* @throws PolicyProcessException
*/
protected DERObject getDERObject(byte[] ext) throws PolicyProcessException {
ASN1InputStream aIn = null;
try {
aIn = new ASN1InputStream(ext);
DERSequence seq = (DERSequence) aIn.readObject();
IOUtils.closeQuietly(aIn);
aIn = new ASN1InputStream(seq.getDEREncoded());
return aIn.readObject();
} catch (Exception e) {
throw new PolicyProcessException("Exception processing data ", e);
} finally {
IOUtils.closeQuietly(aIn);
}
}
Aggregations