Package org.apache.harmony.security.asn1

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


  idp.add(distributionPointTag_);

  /*
   * Next element with tag [1].
   */
  containsUserCerts_ = new ASN1Boolean(false);
  containsUserCertsTag_ = new ASN1TaggedType(TAG_CONTAINS_USER_CERTS,
    containsUserCerts_, false, true);
  idp.add(containsUserCertsTag_);

  /*
   * next element with tag [2].
   */
  containsCaCerts_ = new ASN1Boolean(false);
  containsCaCertsTag_ = new ASN1TaggedType(TAG_CONTAINS_CA_CERTS,
    containsCaCerts_, false, true);
  idp.add(containsCaCertsTag_);

  /*
   * next element with tag [3].
   */
  someReasons_ = new ASN1BitString();
  someReasonsTag_ = new ASN1TaggedType(TAG_SOME_REASONS, someReasons_,
    false, true);
  idp.add(someReasonsTag_);

  /*
   * Final element with tag [4].
   */
  indirectCrl_ = new ASN1Boolean(false);
  indirectCrlTag_ = new ASN1TaggedType(TAG_INDIRECT_CRL, indirectCrl_,
    false, true);
  idp.add(indirectCrlTag_);
  setValue(idp);
    }
View Full Code Here


   * --volker roth
   */
  extnID = new ASN1ObjectIdentifier();
  add(extnID);

  critical = new ASN1Boolean(false);
  critical.setOptional(true);

  add(critical);

  extnValue = new ASN1OctetString();
View Full Code Here

     */
    public ErrorParameterType1(boolean critical, String info)
    {
        super(2);

        critical_     = new ASN1Boolean(critical);
        info_         = new ASN1IA5String(info);

        add(critical_);
        add(info_);
    }
View Full Code Here

     */
    public ErrorParameterType1()
    {
        super(2);

        critical_     = new ASN1Boolean();
        info_         = new ASN1IA5String();

        add(critical_);
        add(info_);
    }
View Full Code Here

     */
    public ErrorParameterType1(boolean critical, String info)
    {
        super(2);

        critical_     = new ASN1Boolean(critical);
        info_         = new ASN1IA5String(info);

        add(critical_);
        add(info_);
    }
View Full Code Here

     */
    public ErrorParameterType1()
    {
        super(2);

        critical_     = new ASN1Boolean();
        info_         = new ASN1IA5String();

        add(critical_);
        add(info_);
    }
View Full Code Here

  byte[] ext_value;
  DERDecoder dec;
  ByteArrayInputStream bais;
  ASN1Sequence seq;
  ASN1Integer pathLen;
  ASN1Boolean ca;

  String bc_oid = "2.5.29.19";

  // get the extension "basic constraints"
  ext_value = getExtensionValue(bc_oid);

  // is it present?
  if (ext_value != null) {

      // read the extension value through a byte array input stream
      bais = new ByteArrayInputStream(ext_value);

      try {

    // build outer sequence
    seq = new ASN1Sequence();

    ca = new ASN1Boolean();
    ca.setOptional(true);
    seq.add(ca);

    pathLen = new ASN1Integer();
    pathLen.setOptional(true);
    seq.add(pathLen);

    /*
     * Switched decoding to the correct way of doing it, which is to
     * take the ASN.1 object and to call its decode() method, rather
     * than calling readX() methods of the decoder. --volker roth
     */
    dec = new DERDecoder(bais);
    seq.decode(dec);
    bais.close();

    if (ca.isTrue()) {
        /*
         * Replaced long->string->int parsing with a simpler method
         * with the same type of loss of precision. --volker roth
         */
        res = pathLen.getBigInteger().intValue();
View Full Code Here

  // set parameters
  setOID(new ASN1ObjectIdentifier(ID_CE_BASIC_CONSTRAINTS));
  setCritical(true); // this is alway the case

  // set payload
  cA = new ASN1Boolean(_cA);
  cA.setOptional(false); // I'm in doubt if that's neccessary

  if (_cA && _pathLenConstraints >= 0) {
      pathLenConstraints = new ASN1Integer(_pathLenConstraints);
      pathLenConstraints.setOptional(false); // mark that it's there
View Full Code Here

                    new byte[] { 0x03, 0x02, 0x07, (byte) 0x80 } } };

    public void testDecode_Encode() throws IOException {

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

        // decode from byte array
        for (int i = 0; i < validBitstring.length; i++) {
            DerInputStream in = new DerInputStream(
                    (byte[]) validBitstring[i][1]);

            BitString expected = (BitString) validBitstring[i][0];
            BitString decoded = (BitString) asn1.decode(in);

            assertEquals("Testcase: " + i, expected.unusedBits,
                    decoded.unusedBits);

            assertTrue("Testcase: " + i, Arrays.equals(expected.bytes,
                    decoded.bytes));
        }

        // decode from input stream
        for (int i = 0; i < validBitstring.length; i++) {
            DerInputStream in = new DerInputStream(new ByteArrayInputStream(
                    (byte[]) validBitstring[i][1]));

            BitString expected = (BitString) validBitstring[i][0];
            BitString decoded = (BitString) asn1.decode(in);

            assertEquals("Testcase: " + i, expected.unusedBits,
                    decoded.unusedBits);

            assertTrue("Testcase: " + i, Arrays.equals(expected.bytes,
View Full Code Here

                {
                        new boolean[] { false, false, false, false, false,
                                false, false, false, true }, // object
                        new byte[] { 0x03, 0x03, 0x07, 0x00, (byte) 0x80 } } };

        ASN1NamedBitList decoder = new ASN1NamedBitList();

        for (int i = 0; i < testcaseBoolean.length; i++) {
            DerInputStream in = new DerInputStream(
                    (byte[]) testcaseBoolean[i][1]);

            assertTrue("Testcase: " + i, Arrays.equals(
                    (boolean[]) testcaseBoolean[i][0], (boolean[]) decoder
                            .decode(in)));
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.harmony.security.asn1.ASN1Boolean

Copyright © 2018 www.massapicom. 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.