Package org.bouncycastle.asn1

Examples of org.bouncycastle.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

    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

    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

TOP

Related Classes of org.bouncycastle.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.