Package sun.security.util

Examples of sun.security.util.DerInputStream


        int oidLen  = (((0xFF & bytes[pos++]) << 8) |
                       (0xFF & bytes[pos++]));
        ObjectIdentifier temp = null;
        try {
            DerInputStream din = new DerInputStream(bytes, pos,
                                                    oidLen);
            temp = new ObjectIdentifier(din);
        } catch (IOException e) {
            throw new GSSExceptionImpl(GSSException.BAD_NAME,
                       "Exported name Object identifier is corrupted!");
View Full Code Here


            Debug.toHexString(x) + "\n";
    }

    protected void parseKeyBits() throws InvalidKeyException {
        try {
            DerInputStream in = new DerInputStream(key);
            x = in.getBigInteger();
        } catch (IOException e) {
            InvalidKeyException ike = new InvalidKeyException(e.getMessage());
            ike.initCause(e);
            throw ike;
        }
View Full Code Here

        // All the elements in issuingDistributionPoint are optional
        if ((val.data == null) || (val.data.available() == 0)) {
            return;
        }

        DerInputStream in = val.data;
        while (in != null && in.available() != 0) {
            DerValue opt = in.getDerValue();

            if (opt.isContextSpecific(TAG_DISTRIBUTION_POINT) &&
                opt.isConstructed()) {
                distributionPoint =
                    new DistributionPointName(opt.data.getDerValue());
View Full Code Here

        BigInteger r = null;
        BigInteger s = null;
        // first decode the signature.
        try {
            DerInputStream in = new DerInputStream(signature, offset, length);
            DerValue[] values = in.getSequence(2);

            r = values[0].getBigInteger();
            s = values[1].getBigInteger();

        } catch (IOException e) {
View Full Code Here

    public static void createPath(String[] certs) throws Exception {

        X509Certificate anchorCert = getCertFromFile(certs[0]);
        byte [] nameConstraints = anchorCert.getExtensionValue("2.5.29.30");
        if (nameConstraints != null) {
            DerInputStream in = new DerInputStream(nameConstraints);
            nameConstraints = in.getOctetString();
        }
        TrustAnchor anchor = new TrustAnchor(anchorCert, nameConstraints);
        List list = new ArrayList();
        for (int i = 1; i < certs.length; i++) {
            list.add(0, getCertFromFile(certs[i]));
View Full Code Here

                                                   (byte)0x5d, (byte)0xc0 };

    public static void main(String args[]) throws Exception {
        byte[] ba0, ba1;
        try {
            DerInputStream derin = new DerInputStream(DER_BITSTRING_PAD6);
            ba1 = derin.getBitString();
        } catch( IOException e ) {
            e.printStackTrace();
            throw new Exception("Unable to parse BitString with 6 padding bits");
        }

        try {
            DerInputStream derin = new DerInputStream(DER_BITSTRING_NOPAD);
            ba0 = derin.getBitString();
        } catch( IOException e ) {
            e.printStackTrace();
            throw new Exception("Unable to parse BitString with no padding");
        }
View Full Code Here

  // correct zero integer
  private final static byte[] INT0 = { 2, 1, 0 };

  public static void main(String args[]) throws Exception {
    try {
      DerInputStream derin = new DerInputStream(INT_LEN0);
      BigInteger bi = derin.getBigInteger();
      throw new Exception("Succeeded parsing invalid zero length value");
    } catch( IOException e ) {
      System.out.println("OK, zero length value rejected.");
    }

    DerInputStream derin = new DerInputStream(INT0);
    BigInteger bi = derin.getBigInteger();
    if( bi.equals(BigInteger.ZERO) == false ) {
      throw new Exception("Failed to parse Integer 0");
    }

  }
View Full Code Here

  private final static byte[] GEN_FRACT3_COMMA_PLUS1 =
    {0x18, 0x17, 0x32, 0x30, 0x30, 0x31, 0x30, 0x38, 0x31, 0x30, 0x31, 0x38, 0x34, 0x33, 0x35, 0x31, 0x2c, 0x37, 0x36, 0x35, 0x2b, 0x30, 0x31, 0x30, 0x30};


  private static Date decodeUTC(byte[] b) throws IOException {
    DerInputStream derin = new DerInputStream(b);
    return derin.getUTCTime();
  }
View Full Code Here

    DerInputStream derin = new DerInputStream(b);
    return derin.getUTCTime();
  }

  private static Date decodeGeneralized(byte[] b) throws IOException {
    DerInputStream derin = new DerInputStream(b);
    return derin.getGeneralizedTime();
  }
View Full Code Here

        throws IOException, ParsingException
    {
        DerValue[] macData = derin.getSequence(2);

        // Parse the digest info
        DerInputStream digestIn = new DerInputStream(macData[0].toByteArray());
        DerValue[] digestInfo = digestIn.getSequence(2);

        // Parse the DigestAlgorithmIdentifier.
        AlgorithmId digestAlgorithmId = AlgorithmId.parse(digestInfo[0]);
        this.digestAlgorithmName = digestAlgorithmId.getName();
        this.digestAlgorithmParams = digestAlgorithmId.getParameters();
View Full Code Here

TOP

Related Classes of sun.security.util.DerInputStream

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.