Examples of DERValue


Examples of com.zaranux.client.crypto.DerValue

     *
     * @exception InvalidKeyException if a parsing error occurs.
     */
    public void decode(InputStream in) throws InvalidKeyException
    {
        DerValue        val;

        try {
            val = new DerValue (in);
            if (val.tag != DerValue.tag_Sequence)
                throw new InvalidKeyException ("invalid key format");

            BigInteger version = val.data.getBigInteger();

View Full Code Here

Examples of gnu.java.security.der.DERValue

  {
    this.encoded = (byte[]) encoded.clone();
    DERReader der = new DERReader(encoded);

    // Extension ::= SEQUENCE {
    DERValue val = der.read();
    if (Configuration.DEBUG)
      log.fine("read val  tag == " + val.getTag() + " len == " + val.getLength());
    if (!val.isConstructed())
      throw new IOException("malformed Extension");

    //   extnID    OBJECT IDENTIFIER,
    val = der.read();
    if (val.getTag() != DER.OBJECT_IDENTIFIER)
      throw new IOException("expecting OBJECT IDENTIFIER");
    oid = (OID) val.getValue();
    if (Configuration.DEBUG)
      log.fine("read oid == " + oid);

    //   critical  BOOLEAN DEFAULT FALSE,
    val = der.read();
    if (val.getTag() == DER.BOOLEAN)
      {
        critical = ((Boolean) val.getValue()).booleanValue();
        val = der.read();
      }
    else
      critical = false;
    if (Configuration.DEBUG)
      log.fine("is critical == " + critical);

    //   extnValue OCTET STRING }
    if (val.getTag() != DER.OCTET_STRING)
      throw new IOException("expecting OCTET STRING");
    byte[] encval = (byte[]) val.getValue();
    isSupported = true;
    if (oid.equals(AuthorityKeyIdentifier.ID))
      {
        value = new AuthorityKeyIdentifier(encval);
      }
View Full Code Here

Examples of sun.security.util.DerValue

     * @exception GSSException may be thrown when the DER encoding does not
     *  follow the prescribed format.
     */
    public Oid(InputStream derOid) throws GSSException {
  try {
      DerValue derVal = new DerValue(derOid);
      derEncoding = derVal.toByteArray();
      oid = derVal.getOID();
  } catch (IOException e) {
            throw new GSSException(GSSException.FAILURE,
                          "Improperly formatted ASN.1 DER encoding for Oid");
  }
    }
View Full Code Here

Examples of sun.security.util.DerValue

     * @exception GSSException may be thrown when the DER encoding does not
     *     follow the prescribed format.
     */
    public Oid(byte [] data) throws GSSException {
  try {
      DerValue derVal = new DerValue(data);
      derEncoding = derVal.toByteArray();
      oid = derVal.getOID();
  } catch (IOException e) {
            throw new GSSException(GSSException.FAILURE,
                          "Improperly formatted ASN.1 DER encoding for Oid");
  }
    }
View Full Code Here

Examples of sun.security.util.DerValue

         
          /**
           * Use sun.security.util.DerValue if it is present.
           */
          try {             
                  DerValue dervalue = new DerValue(derEncodedValue);
                  if (dervalue == null) {
                      throw new XMLSecurityException("certificate.noSki.null");
                  }
                  if (dervalue.tag != DerValue.tag_OctetString) {
                      throw new XMLSecurityException("certificate.noSki.notOctetString");
                  }
                  extensionValue = dervalue.getOctetString();             
          } catch (NoClassDefFoundError e) {
          }
         
          /**
           * Fall back to org.bouncycastle.asn1.DERInputStream
View Full Code Here

Examples of sun.security.util.DerValue

         
          /**
           * Use sun.security.util.DerValue if it is present.
           */
          try {             
                  DerValue dervalue = new DerValue(derEncodedValue);
                  if (dervalue == null) {
                      throw new XMLSecurityException("certificate.noSki.null");
                  }
                  if (dervalue.tag != DerValue.tag_OctetString) {
                      throw new XMLSecurityException("certificate.noSki.notOctetString");
                  }
                  extensionValue = dervalue.getOctetString();             
          } catch (NoClassDefFoundError e) {
          }
         
          /**
           * Fall back to org.bouncycastle.asn1.DERInputStream
View Full Code Here

Examples of sun.security.util.DerValue

            throw new XMLSecurityException("certificate.noSki.lowVersion",
                                           exArgs);
         }

         DerValue dervalue = new DerValue(derEncodedValue);

         if (dervalue == null) {
            throw new XMLSecurityException("certificate.noSki.null");
         }

         if (dervalue.tag != DerValue.tag_OctetString) {
            throw new XMLSecurityException("certificate.noSki.notOctetString");
         }

         byte[] extensionValue = dervalue.getOctetString();

         /**
          * Strip away first two bytes from the DerValue (tag and length)
          */
         byte abyte0[] = new byte[extensionValue.length - 2];
View Full Code Here

Examples of sun.security.util.DerValue

    DerValue[] values = ticketStream.getSet(ticket.length, true);

    // Look for the AP_REQ.
    // AP-REQ ::= [APPLICATION 14] SEQUENCE
    for (int i = 0; i < values.length; i++) {
      DerValue value = values[i];
      if (value.isConstructed((byte) 14)) {
        value.resetTag(DerValue.tag_Set);
        return parseApReq(value.toDerInputStream(), value.length());
      }
    }
    throw new Exception("Could not find AP-REQ in service ticket.");
  }
View Full Code Here

Examples of sun.security.util.DerValue

  }

  // Parse the GSS AP-REQ token.
  private EncryptionKey parseApReq(DerInputStream reqStream, int len)
      throws Exception {
    DerValue ticket = null;

    DerValue[] values = reqStream.getSet(len, true);

    for (int i = 0; i < values.length; i++) {
      DerValue value = values[i];
      if (value.isContextSpecific((byte) 3)) {
        ticket = value.getData().getDerValue();
      }
    }

    if (ticket == null) {
      throw new Exception("No Ticket found in AP-REQ PDU");
View Full Code Here

Examples of sun.security.util.DerValue

     * @exception GSSException may be thrown when the DER encoding does not
     *  follow the prescribed format.
     */
    public Oid(InputStream derOid) throws GSSException {
        try {
            DerValue derVal = new DerValue(derOid);
            derEncoding = derVal.toByteArray();
            oid = derVal.getOID();
        } catch (IOException e) {
            throw new GSSException(GSSException.FAILURE,
                          "Improperly formatted ASN.1 DER encoding for Oid");
        }
    }
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.