Search in sources :

Example 36 with ASN1Exception

use of com.github.zhenwei.core.asn1.ASN1Exception in project keystore-explorer by kaikramer.

the class DViewCsr method asn1DumpPressed.

private void asn1DumpPressed() {
    try {
        DViewAsn1Dump dViewAsn1Dump;
        if (pkcs10Csr != null) {
            dViewAsn1Dump = new DViewAsn1Dump(this, pkcs10Csr);
        } else {
            dViewAsn1Dump = new DViewAsn1Dump(this, spkacCsr);
        }
        dViewAsn1Dump.setLocationRelativeTo(this);
        dViewAsn1Dump.setVisible(true);
    } catch (Asn1Exception ex) {
        DError dError = new DError(this, ex);
        dError.setLocationRelativeTo(this);
        dError.setVisible(true);
    } catch (IOException ex) {
        DError dError = new DError(this, ex);
        dError.setLocationRelativeTo(this);
        dError.setVisible(true);
    }
}
Also used : IOException(java.io.IOException) Asn1Exception(org.kse.utilities.asn1.Asn1Exception) DError(org.kse.gui.error.DError)

Example 37 with ASN1Exception

use of com.github.zhenwei.core.asn1.ASN1Exception in project keystore-explorer by kaikramer.

the class DViewPrivateKey method asn1DumpPressed.

private void asn1DumpPressed() {
    try {
        DViewAsn1Dump dViewAsn1Dump = new DViewAsn1Dump(this, privateKey);
        dViewAsn1Dump.setLocationRelativeTo(this);
        dViewAsn1Dump.setVisible(true);
    } catch (Asn1Exception ex) {
        DError dError = new DError(this, ex);
        dError.setLocationRelativeTo(this);
        dError.setVisible(true);
    } catch (IOException ex) {
        DError dError = new DError(this, ex);
        dError.setLocationRelativeTo(this);
        dError.setVisible(true);
    }
}
Also used : IOException(java.io.IOException) Asn1Exception(org.kse.utilities.asn1.Asn1Exception) DError(org.kse.gui.error.DError)

Example 38 with ASN1Exception

use of com.github.zhenwei.core.asn1.ASN1Exception in project keystore-explorer by kaikramer.

the class DViewExtensions method asn1DumpPressed.

private void asn1DumpPressed() {
    int selectedRow = jtExtensions.getSelectedRow();
    if (selectedRow == -1) {
        return;
    }
    String oid = ((ASN1ObjectIdentifier) jtExtensions.getValueAt(selectedRow, 2)).getId();
    byte[] value = extensions.getExtensionValue(oid);
    boolean criticality = (Boolean) jtExtensions.getValueAt(selectedRow, 0);
    X509Ext extension = new X509Ext(oid, value, criticality);
    try {
        DViewAsn1Dump dViewAsn1Dump = new DViewAsn1Dump(this, extension);
        dViewAsn1Dump.setLocationRelativeTo(this);
        dViewAsn1Dump.setVisible(true);
    } catch (Asn1Exception | IOException e) {
        DError.displayError(this, e);
    }
}
Also used : DViewAsn1Dump(org.kse.gui.dialogs.DViewAsn1Dump) IOException(java.io.IOException) Asn1Exception(org.kse.utilities.asn1.Asn1Exception) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier) X509Ext(org.kse.crypto.x509.X509Ext)

Example 39 with ASN1Exception

use of com.github.zhenwei.core.asn1.ASN1Exception in project jmulticard by ctt-gob-es.

the class Dnie method getCdf.

/**
 * Obtiene el CDF PKCS#15 del DNIe.
 * @return CDF PKCS#15 del DNIe.
 * @throws ApduConnectionException Si no se puede conectar con el DNIe.
 */
public Cdf getCdf() throws ApduConnectionException {
    final Cdf cdf = new Cdf();
    try {
        selectMasterFile();
        final byte[] cdfBytes = selectFileByLocationAndRead(CDF_LOCATION);
        cdf.setDerValue(cdfBytes);
    } catch (final IOException | Iso7816FourCardException | Asn1Exception | TlvException e) {
        throw new ApduConnectionException(// $NON-NLS-1$
        "No se ha podido cargar el CDF de la tarjeta", // $NON-NLS-1$
        e);
    }
    return cdf;
}
Also used : TlvException(es.gob.jmulticard.asn1.TlvException) Iso7816FourCardException(es.gob.jmulticard.card.iso7816four.Iso7816FourCardException) Cdf(es.gob.jmulticard.asn1.der.pkcs15.Cdf) IOException(java.io.IOException) Asn1Exception(es.gob.jmulticard.asn1.Asn1Exception) ApduConnectionException(es.gob.jmulticard.apdu.connection.ApduConnectionException)

Example 40 with ASN1Exception

use of com.github.zhenwei.core.asn1.ASN1Exception in project jmulticard by ctt-gob-es.

the class Dnie3 method getDg13.

@Override
public OptionalDetails getDg13() throws IOException {
    try {
        final OptionalDetails ret = new OptionalDetailsDnie3();
        ret.setDerValue(selectFileByLocationAndRead(FILE_DG13_LOCATION));
        return ret;
    } catch (final es.gob.jmulticard.card.iso7816four.FileNotFoundException e) {
        // $NON-NLS-1$
        throw (IOException) new FileNotFoundException("DG13 no encontrado").initCause(e);
    } catch (final Iso7816FourCardException | TlvException | Asn1Exception e) {
        // $NON-NLS-1$
        throw new CryptoCardException("Error leyendo el DG13", e);
    }
}
Also used : TlvException(es.gob.jmulticard.asn1.TlvException) OptionalDetails(es.gob.jmulticard.asn1.icao.OptionalDetails) Iso7816FourCardException(es.gob.jmulticard.card.iso7816four.Iso7816FourCardException) FileNotFoundException(java.io.FileNotFoundException) Asn1Exception(es.gob.jmulticard.asn1.Asn1Exception) CryptoCardException(es.gob.jmulticard.card.CryptoCardException)

Aggregations

IOException (java.io.IOException)18 Asn1Exception (es.gob.jmulticard.asn1.Asn1Exception)16 ASN1Exception (com.unboundid.asn1.ASN1Exception)12 TlvException (es.gob.jmulticard.asn1.TlvException)12 Asn1Exception (sun.security.krb5.Asn1Exception)11 ASN1Element (com.unboundid.asn1.ASN1Element)7 ASN1OctetString (com.unboundid.asn1.ASN1OctetString)7 NotNull (com.unboundid.util.NotNull)7 Iso7816FourCardException (es.gob.jmulticard.card.iso7816four.Iso7816FourCardException)7 CertificateException (java.security.cert.CertificateException)7 X509Certificate (java.security.cert.X509Certificate)7 Asn1Exception (org.kse.utilities.asn1.Asn1Exception)7 ASN1Exception (org.wildfly.security.asn1.ASN1Exception)6 ApduConnectionException (es.gob.jmulticard.apdu.connection.ApduConnectionException)5 Cdf (es.gob.jmulticard.asn1.der.pkcs15.Cdf)5 CryptoCardException (es.gob.jmulticard.card.CryptoCardException)5 ASN1Sequence (com.unboundid.asn1.ASN1Sequence)4 DecoderObject (es.gob.jmulticard.asn1.DecoderObject)4 InvalidCardException (es.gob.jmulticard.card.InvalidCardException)4 DerValue (sun.security.util.DerValue)4