Examples of ASN1Boolean


Examples of org.apache.harmony.security.asn1.ASN1Boolean

    private static byte[] eTrue = new byte[] { 0x01, 0x01, (byte) 0xFF };

    public void test_Decode_Encode() throws IOException {

        // oid decoder/encoder for testing
        ASN1Boolean asn1 = ASN1Boolean.getInstance();

        // decoding false
        DerInputStream in = new DerInputStream(eFalse);
        assertEquals("Decoding false value", Boolean.FALSE, asn1.decode(in));

        // decoding true
        in = new DerInputStream(eTrue);
        assertEquals("Decoding true value", Boolean.TRUE, asn1.decode(in));

        // encoding false
        DerOutputStream out = new DerOutputStream(asn1, Boolean.FALSE);
        assertTrue("Encoding false value", Arrays.equals(eFalse, out.encoded));
View Full Code Here

Examples of org.bouncycastle.asn1.ASN1Boolean

            {
                Object o = seq.getObjectAt(i);

                if (o instanceof ASN1Boolean)
                {
                    ASN1Boolean x = ASN1Boolean.getInstance(o);
                    result.setInhibitPolicyMapping(x.isTrue());
                }
                else if (o instanceof ASN1TaggedObject)
                {
                    ASN1TaggedObject t = ASN1TaggedObject.getInstance(o);
                    ASN1Boolean x;
                    switch (t.getTagNo())
                    {
                    case 0:
                        x = ASN1Boolean.getInstance(t, false);
                        result.setExplicitPolicyReqd(x.isTrue());
                        break;
                    case 1:
                        x = ASN1Boolean.getInstance(t, false);
                        result.setInhibitAnyPolicy(x.isTrue());
                    }
                }
            }
            return result;
        }
View Full Code Here

Examples of org.bouncycastle.asn1.ASN1Boolean

        v.add(new DERSequence(pV));

        if (inhibitPolicyMapping)
        {
            v.add(new ASN1Boolean(inhibitPolicyMapping));
        }
        if (explicitPolicyReqd)
        {
            v.add(new DERTaggedObject(false, 0, new ASN1Boolean(explicitPolicyReqd)));
        }
        if (inhibitAnyPolicy)
        {
            v.add(new DERTaggedObject(false, 1, new ASN1Boolean(inhibitAnyPolicy)));
        }

        return new DERSequence(v);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.