use of org.gudy.bouncycastle.asn1.ASN1InputStream in project keepass2android by PhilippC.
the class Dump method main.
public static void main(String[] args) throws Exception {
FileInputStream fIn = new FileInputStream(args[0]);
ASN1InputStream bIn = new ASN1InputStream(fIn);
Object obj = null;
while ((obj = bIn.readObject()) != null) {
System.out.println(ASN1Dump.dumpAsString(obj));
}
}
use of org.gudy.bouncycastle.asn1.ASN1InputStream in project android_packages_apps_Settings by crdroidandroid.
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 org.gudy.bouncycastle.asn1.ASN1InputStream in project keystore-explorer by kaikramer.
the class DKeyUsage method prepopulateWithValue.
private void prepopulateWithValue(byte[] value) throws IOException {
// we have a ByteArrayInputStream here which does not need to be closed
@SuppressWarnings("resource") DERBitString keyUsage = DERBitString.getInstance(new ASN1InputStream(value).readObject());
int keyUsageValue = keyUsage.intValue();
jcbDigitalSignature.setSelected(hasKeyUsage(keyUsageValue, KeyUsage.digitalSignature));
jcbNonRepudiation.setSelected(hasKeyUsage(keyUsageValue, KeyUsage.nonRepudiation));
jcbKeyEncipherment.setSelected(hasKeyUsage(keyUsageValue, KeyUsage.keyEncipherment));
jcbDataEncipherment.setSelected(hasKeyUsage(keyUsageValue, KeyUsage.dataEncipherment));
jcbKeyAgreement.setSelected(hasKeyUsage(keyUsageValue, KeyUsage.keyAgreement));
jcbCertificateSigning.setSelected(hasKeyUsage(keyUsageValue, KeyUsage.keyCertSign));
jcbCrlSign.setSelected(hasKeyUsage(keyUsageValue, KeyUsage.cRLSign));
jcbEncipherOnly.setSelected(hasKeyUsage(keyUsageValue, KeyUsage.encipherOnly));
jcbDecipherOnly.setSelected(hasKeyUsage(keyUsageValue, KeyUsage.decipherOnly));
}
use of org.gudy.bouncycastle.asn1.ASN1InputStream in project keystore-explorer by kaikramer.
the class DNetscapeCertificateType method prepopulateWithValue.
private void prepopulateWithValue(byte[] value) throws IOException {
// we have a ByteArrayInputStream here which does not need to be closed
@SuppressWarnings("resource") DERBitString netscapeCertType = DERBitString.getInstance(new ASN1InputStream(value).readObject());
int netscapeCertTypes = netscapeCertType.intValue();
jcbSslClient.setSelected(isCertType(netscapeCertTypes, NetscapeCertType.sslClient));
jcbSslServer.setSelected(isCertType(netscapeCertTypes, NetscapeCertType.sslServer));
jcbSmime.setSelected(isCertType(netscapeCertTypes, NetscapeCertType.smime));
jcbObjectSigning.setSelected(isCertType(netscapeCertTypes, NetscapeCertType.objectSigning));
jcbReserved.setSelected(isCertType(netscapeCertTypes, NetscapeCertType.reserved));
jcbSslCa.setSelected(isCertType(netscapeCertTypes, NetscapeCertType.sslCA));
jcbSmimeCa.setSelected(isCertType(netscapeCertTypes, NetscapeCertType.smimeCA));
jcbObjectSigningCa.setSelected(isCertType(netscapeCertTypes, NetscapeCertType.objectSigningCA));
}
use of org.gudy.bouncycastle.asn1.ASN1InputStream in project jmulticard by ctt-gob-es.
the class DO8E method fromByteArray.
void fromByteArray(final byte[] encodedData) throws SecureMessagingException {
try (final ASN1InputStream asn1in = new ASN1InputStream(encodedData)) {
this.to = (DERTaggedObject) asn1in.readObject();
} catch (final IOException e) {
throw new SecureMessagingException(e);
}
final DEROctetString ocs = (DEROctetString) this.to.getObject();
this.data = ocs.getOctets();
}
Aggregations