Search in sources :

Example 31 with Asn1Exception

use of es.gob.jmulticard.asn1.Asn1Exception in project jmulticard by ctt-gob-es.

the class TestDerBoolean method testGetBytes.

/**
 * Test method for {@link es.gob.jmulticard.asn1.DecoderObject#getBytes()}.
 * @throws TlvException Si no se puede crear el TLV.
 * @throws Asn1Exception Si falla la creación del tipo ASN1.
 */
public static final void testGetBytes() throws Asn1Exception, TlvException {
    final DerBoolean db = new DerBoolean();
    db.setDerValue(new byte[] { (byte) 0x01, (byte) 0x01, (byte) 0x00 });
    // $NON-NLS-1$
    Assert.assertEquals("010100", HexUtils.hexify(db.getBytes(), false));
}
Also used : DerBoolean(es.gob.jmulticard.asn1.der.DerBoolean)

Example 32 with Asn1Exception

use of es.gob.jmulticard.asn1.Asn1Exception in project jmulticard by ctt-gob-es.

the class TestDerBoolean method testCheckTagWithWrongTagMustThrowException.

/**
 * Test method for {@link es.gob.jmulticard.asn1.DecoderObject#checkTag(byte)}.
 */
public static final void testCheckTagWithWrongTagMustThrowException() {
    try {
        final DerBoolean db = new DerBoolean();
        db.checkTag((byte) 0x02);
    } catch (final Exception e) {
        if (!(e instanceof Asn1Exception)) {
            // $NON-NLS-1$ //$NON-NLS-2$
            Assert.fail("Se esperaba " + Asn1Exception.class.getName() + " pero se obtuvo " + e.getClass().getName());
        }
    }
}
Also used : DerBoolean(es.gob.jmulticard.asn1.der.DerBoolean) Asn1Exception(es.gob.jmulticard.asn1.Asn1Exception) TlvException(es.gob.jmulticard.asn1.TlvException) Asn1Exception(es.gob.jmulticard.asn1.Asn1Exception)

Aggregations

IOException (java.io.IOException)12 Asn1Exception (es.gob.jmulticard.asn1.Asn1Exception)10 Asn1Exception (sun.security.krb5.Asn1Exception)9 TlvException (es.gob.jmulticard.asn1.TlvException)8 Tlv (es.gob.jmulticard.asn1.Tlv)6 DError (org.kse.gui.error.DError)6 Asn1Exception (org.kse.utilities.asn1.Asn1Exception)6 X509Certificate (java.security.cert.X509Certificate)5 DecoderObject (es.gob.jmulticard.asn1.DecoderObject)4 ASN1Exception (codec.asn1.ASN1Exception)3 PFX (codec.pkcs12.PFX)3 ApduConnectionException (es.gob.jmulticard.apdu.connection.ApduConnectionException)3 Cdf (es.gob.jmulticard.asn1.der.pkcs15.Cdf)3 InvalidCardException (es.gob.jmulticard.card.InvalidCardException)3 Location (es.gob.jmulticard.card.Location)3 FileNotFoundException (es.gob.jmulticard.card.iso7816four.FileNotFoundException)3 Iso7816FourCardException (es.gob.jmulticard.card.iso7816four.Iso7816FourCardException)3 BigInteger (java.math.BigInteger)3 DerBoolean (es.gob.jmulticard.asn1.der.DerBoolean)2 Odf (es.gob.jmulticard.asn1.der.pkcs15.Odf)2