Package org.apache.harmony.security.asn1

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


    /**
     * implemented abstract method from
     * {@link java.security.cert.X509CRLEntry java.security.cert.X509CRLEntry}
     */
    public Date getRevocationDate() {
  ASN1Time a1t = (ASN1Time) revocationDate_.getInnerType();
  return a1t.getDate();
    }
View Full Code Here


    /**
     * set the date of this revocation entry
     */
    public void setRevocationDate(Calendar cal) {

  ASN1Time inner = (ASN1Time) revocationDate_.getInnerType();

  if (inner == null) {
      inner = new ASN1UTCTime(cal);
      revocationDate_.setInnerType(inner);
  }

  inner.setDate(cal);
    }
View Full Code Here

     * @param nnaf
     *                "not after" date
     */
    public void setNotAfter(Calendar nnaf) {

  ASN1Time nai = (ASN1Time) notAfter_.getInnerType();

  if (nai == null) {
      nai = new ASN1UTCTime();
      notAfter_.setInnerType(nai);
  }

  nai.setDate(nnaf);
    }
View Full Code Here

     *
     * @param nnbf
     *                "not before" date
     */
    public void setNotBefore(Calendar nnbf) {
  ASN1Time nai = (ASN1Time) notBefore_.getInnerType();

  if (nai == null) {
      nai = new ASN1UTCTime();
      notBefore_.setInnerType(nai);
  }

  nai.setDate(nnbf);
    }
View Full Code Here

    public Date getNextUpdate() {

  if (nextUpdate.isOptional())
      return null;

  ASN1Time a1t = (ASN1Time) nextUpdate.getInnerType();

  return a1t.getDate();
    }
View Full Code Here

    /**
     * returns the issuing date of this crl update
     */
    public Date getThisUpdate() {
  ASN1Time a1t = (ASN1Time) thisUpdate.getInnerType();

  return a1t.getDate();
    }
View Full Code Here

   * ASN1GeneralizedTime());
   *
   * TBSCertList.add(nextUpdate);
   */

  ASN1Time akt_time = (ASN1Time) nextUpdate.getInnerType();
  if (akt_time == null) {
      akt_time = new ASN1UTCTime(time);
      nextUpdate.setInnerType(akt_time);
  }
  akt_time.setDate(time);
  nextUpdate.setOptional(false);
    }
View Full Code Here

    /**
     * sets the date of this update
     */
    public void setThisUpdate(Calendar time) {

  ASN1Time akt_time = (ASN1Time) thisUpdate.getInnerType();
  if (akt_time == null) {
      akt_time = new ASN1UTCTime(time);
      thisUpdate.setInnerType(akt_time);
  }

  akt_time.setDate(time);
    }
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.ASN1Time

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.