コード例 #1
0
 /*     */ public PAEncTSEnc(DerValue paramDerValue) /*     */ throws Asn1Exception, IOException
       /*     */ {
   /*  81 */ if (paramDerValue.getTag() != 48) {
     /*  82 */ throw new Asn1Exception(906);
     /*     */ }
   /*  84 */ this.pATimeStamp = KerberosTime.parse(paramDerValue.getData(), (byte) 0, false);
   /*  85 */ if (paramDerValue.getData().available() > 0) {
     /*  86 */ DerValue localDerValue = paramDerValue.getData().getDerValue();
     /*  87 */ if ((localDerValue.getTag() & 0x1F) == 1)
       /*  88 */ this.pAUSec = new Integer(localDerValue.getData().getBigInteger().intValue());
     /*     */ else /*  90 */ throw new Asn1Exception(906);
     /*     */ }
   /*  92 */ if (paramDerValue.getData().available() > 0) /*  93 */ throw new Asn1Exception(906);
   /*     */ }
コード例 #2
0
ファイル: MethodData.java プロジェクト: FauxFaux/jdk9-jdk
 /**
  * Constructs a MethodData object.
  *
  * @param encoding a Der-encoded data.
  * @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
  * @exception IOException if an I/O error occurs while reading encoded data.
  */
 public MethodData(DerValue encoding) throws Asn1Exception, IOException {
   DerValue der;
   if (encoding.getTag() != DerValue.tag_Sequence) {
     throw new Asn1Exception(Krb5.ASN1_BAD_ID);
   }
   der = encoding.getData().getDerValue();
   if ((der.getTag() & 0x1F) == 0x00) {
     BigInteger bint = der.getData().getBigInteger();
     methodType = bint.intValue();
   } else throw new Asn1Exception(Krb5.ASN1_BAD_ID);
   if (encoding.getData().available() > 0) {
     der = encoding.getData().getDerValue();
     if ((der.getTag() & 0x1F) == 0x01) {
       methodData = der.getData().getOctetString();
     } else throw new Asn1Exception(Krb5.ASN1_BAD_ID);
   }
   if (encoding.getData().available() > 0) throw new Asn1Exception(Krb5.ASN1_BAD_ID);
 }
コード例 #3
0
ファイル: Realm.java プロジェクト: krichter722/jdk9-jdk9-jdk
 /**
  * Parse (unmarshal) a realm from a DER input stream. This form parsing might be used when
  * expanding a value which is part of a constructed sequence and uses explicitly tagged type.
  *
  * @exception Asn1Exception on error.
  * @param data the Der input stream value, which contains one or more marshaled value.
  * @param explicitTag tag number.
  * @param optional indicate if this data field is optional
  * @return an instance of Realm.
  */
 public static Realm parse(DerInputStream data, byte explicitTag, boolean optional)
     throws Asn1Exception, IOException, RealmException {
   if ((optional) && (((byte) data.peekByte() & (byte) 0x1F) != explicitTag)) {
     return null;
   }
   DerValue der = data.getDerValue();
   if (explicitTag != (der.getTag() & (byte) 0x1F)) {
     throw new Asn1Exception(Krb5.ASN1_BAD_ID);
   } else {
     DerValue subDer = der.getData().getDerValue();
     return new Realm(subDer);
   }
 }
コード例 #4
0
 /**
  * Returns the ASN.1 encoding of the <xmp> PrincipalName ::= SEQUENCE { name-type [0] Int32,
  * name-string [1] SEQUENCE OF KerberosString }
  *
  * <p>KerberosString ::= GeneralString (IA5String) </xmp>
  *
  * <p>This definition reflects the Network Working Group RFC 4120 specification available at <a
  * href="http://www.ietf.org/rfc/rfc4120.txt">http://www.ietf.org/rfc/rfc4120.txt</a>.
  *
  * @param encoding a Der-encoded data.
  * @param realm the realm for this name
  * @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
  * @exception Asn1Exception if there is an ASN1 encoding error
  * @exception IOException if an I/O error occurs
  * @exception IllegalArgumentException if encoding is null reading encoded data.
  */
 public PrincipalName(DerValue encoding, Realm realm) throws Asn1Exception, IOException {
   if (realm == null) {
     throw new IllegalArgumentException("Null realm not allowed");
   }
   nameRealm = realm;
   DerValue der;
   if (encoding == null) {
     throw new IllegalArgumentException("Null encoding not allowed");
   }
   if (encoding.getTag() != DerValue.tag_Sequence) {
     throw new Asn1Exception(Krb5.ASN1_BAD_ID);
   }
   der = encoding.getData().getDerValue();
   if ((der.getTag() & 0x1F) == 0x00) {
     BigInteger bint = der.getData().getBigInteger();
     nameType = bint.intValue();
   } else {
     throw new Asn1Exception(Krb5.ASN1_BAD_ID);
   }
   der = encoding.getData().getDerValue();
   if ((der.getTag() & 0x01F) == 0x01) {
     DerValue subDer = der.getData().getDerValue();
     if (subDer.getTag() != DerValue.tag_SequenceOf) {
       throw new Asn1Exception(Krb5.ASN1_BAD_ID);
     }
     Vector<String> v = new Vector<>();
     DerValue subSubDer;
     while (subDer.getData().available() > 0) {
       subSubDer = subDer.getData().getDerValue();
       String namePart = new KerberosString(subSubDer).toString();
       v.addElement(namePart);
     }
     nameStrings = new String[v.size()];
     v.copyInto(nameStrings);
     validateNameStrings(nameStrings);
   } else {
     throw new Asn1Exception(Krb5.ASN1_BAD_ID);
   }
 }
コード例 #5
0
 /*     */ public static TicketFlags parse(
     DerInputStream paramDerInputStream, byte paramByte, boolean paramBoolean)
     /*     */ throws Asn1Exception, IOException
       /*     */ {
   /*  92 */ if ((paramBoolean) && (((byte) paramDerInputStream.peekByte() & 0x1F) != paramByte))
     /*  93 */ return null;
   /*  94 */ DerValue localDerValue1 = paramDerInputStream.getDerValue();
   /*  95 */ if (paramByte != (localDerValue1.getTag() & 0x1F)) {
     /*  96 */ throw new Asn1Exception(906);
     /*     */ }
   /*     */
   /*  99 */ DerValue localDerValue2 = localDerValue1.getData().getDerValue();
   /* 100 */ return new TicketFlags(localDerValue2);
   /*     */ }
コード例 #6
0
  private void init(DerValue encoding) throws Asn1Exception, IOException, RealmException {
    DerValue der, subDer;

    renewTill = null;
    caddr = null;
    authorizationData = null;
    if (((encoding.getTag() & (byte) 0x1F) != (byte) 0x03)
        || (encoding.isApplication() != true)
        || (encoding.isConstructed() != true)) {
      throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
      throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    flags = TicketFlags.parse(der.getData(), (byte) 0x00, false);
    key = EncryptionKey.parse(der.getData(), (byte) 0x01, false);
    Realm crealm = Realm.parse(der.getData(), (byte) 0x02, false);
    cname = PrincipalName.parse(der.getData(), (byte) 0x03, false, crealm);
    transited = TransitedEncoding.parse(der.getData(), (byte) 0x04, false);
    authtime = KerberosTime.parse(der.getData(), (byte) 0x05, false);
    starttime = KerberosTime.parse(der.getData(), (byte) 0x06, true);
    endtime = KerberosTime.parse(der.getData(), (byte) 0x07, false);
    if (der.getData().available() > 0) {
      renewTill = KerberosTime.parse(der.getData(), (byte) 0x08, true);
    }
    if (der.getData().available() > 0) {
      caddr = HostAddresses.parse(der.getData(), (byte) 0x09, true);
    }
    if (der.getData().available() > 0) {
      authorizationData = AuthorizationData.parse(der.getData(), (byte) 0x0A, true);
    }
    if (der.getData().available() > 0) {
      throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
  }
コード例 #7
0
 /*     */ private void init(DerValue paramDerValue)
     /*     */ throws Asn1Exception, IOException, RealmException
       /*     */ {
   /* 140 */ this.renewTill = null;
   /* 141 */ this.caddr = null;
   /* 142 */ this.authorizationData = null;
   /* 143 */ if (((paramDerValue.getTag() & 0x1F) != 3)
       || (paramDerValue.isApplication() != true)
       || (paramDerValue.isConstructed() != true))
   /*     */ {
     /* 146 */ throw new Asn1Exception(906);
     /*     */ }
   /* 148 */ DerValue localDerValue = paramDerValue.getData().getDerValue();
   /* 149 */ if (localDerValue.getTag() != 48) {
     /* 150 */ throw new Asn1Exception(906);
     /*     */ }
   /* 152 */ this.flags = TicketFlags.parse(localDerValue.getData(), (byte) 0, false);
   /* 153 */ this.key = EncryptionKey.parse(localDerValue.getData(), (byte) 1, false);
   /* 154 */ this.crealm = Realm.parse(localDerValue.getData(), (byte) 2, false);
   /* 155 */ this.cname = PrincipalName.parse(localDerValue.getData(), (byte) 3, false);
   /* 156 */ this.transited = TransitedEncoding.parse(localDerValue.getData(), (byte) 4, false);
   /* 157 */ this.authtime = KerberosTime.parse(localDerValue.getData(), (byte) 5, false);
   /* 158 */ this.starttime = KerberosTime.parse(localDerValue.getData(), (byte) 6, true);
   /* 159 */ this.endtime = KerberosTime.parse(localDerValue.getData(), (byte) 7, false);
   /* 160 */ if (localDerValue.getData().available() > 0) {
     /* 161 */ this.renewTill = KerberosTime.parse(localDerValue.getData(), (byte) 8, true);
     /*     */ }
   /* 163 */ if (localDerValue.getData().available() > 0) {
     /* 164 */ this.caddr = HostAddresses.parse(localDerValue.getData(), (byte) 9, true);
     /*     */ }
   /* 166 */ if (localDerValue.getData().available() > 0) {
     /* 167 */ this.authorizationData =
         AuthorizationData.parse(localDerValue.getData(), (byte) 10, true);
     /*     */ }
   /* 169 */ if (localDerValue.getData().available() > 0) /* 170 */ throw new Asn1Exception(906);
   /*     */ }
コード例 #8
0
  /**
   * Parse (unmarshal) a <code>PrincipalName</code> from a DER input stream. This form parsing might
   * be used when expanding a value which is part of a constructed sequence and uses explicitly
   * tagged type.
   *
   * @exception Asn1Exception on error.
   * @param data the Der input stream value, which contains one or more marshaled value.
   * @param explicitTag tag number.
   * @param optional indicate if this data field is optional
   * @param realm the realm for the name
   * @return an instance of <code>PrincipalName</code>, or null if the field is optional and
   *     missing.
   */
  public static PrincipalName parse(
      DerInputStream data, byte explicitTag, boolean optional, Realm realm)
      throws Asn1Exception, IOException, RealmException {

    if ((optional) && (((byte) data.peekByte() & (byte) 0x1F) != explicitTag)) return null;
    DerValue der = data.getDerValue();
    if (explicitTag != (der.getTag() & (byte) 0x1F)) {
      throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    } else {
      DerValue subDer = der.getData().getDerValue();
      if (realm == null) {
        realm = Realm.getDefault();
      }
      return new PrincipalName(subDer, realm);
    }
  }