public KerberosToken ( byte[] token, KerberosKey[] keys ) throws PACDecodingException { if ( token.length <= 0 ) throw new PACDecodingException("Empty kerberos token"); try { ASN1InputStream stream = new ASN1InputStream(new ByteArrayInputStream(token)); DERApplicationSpecific derToken = ASN1Util.as(DERApplicationSpecific.class, stream); if ( derToken == null || !derToken.isConstructed() ) throw new PACDecodingException("Malformed kerberos token"); stream.close(); stream = new ASN1InputStream(new ByteArrayInputStream(derToken.getContents())); ASN1ObjectIdentifier kerberosOid = ASN1Util.as(ASN1ObjectIdentifier.class, stream); if ( !kerberosOid.getId().equals(KerberosConstants.KERBEROS_OID) ) throw new PACDecodingException("Not a kerberos token"); int read = 0; int readLow = stream.read() & 0xff; int readHigh = stream.read() & 0xff; read = ( readHigh << 8 ) + readLow; if ( read != 0x01 ) throw new PACDecodingException("Malformed kerberos token"); DERApplicationSpecific krbToken = ASN1Util.as(DERApplicationSpecific.class, stream); if ( krbToken == null || !krbToken.isConstructed() ) throw new PACDecodingException("Malformed kerberos token"); stream.close(); this.apRequest = new KerberosApRequest(krbToken.getContents(), keys); } catch ( IOException e ) { throw new PACDecodingException("Malformed kerberos token", e); } }
public ASN1Primitive readObject() throws IOException int tag = read(); if (tag <= 0)
public ASN1Primitive readObject() throws IOException int tag = read(); if (tag <= 0)
public KerberosToken ( byte[] token, KerberosKey[] keys ) throws PACDecodingException { if ( token.length <= 0 ) throw new PACDecodingException("Empty kerberos token"); try { ASN1InputStream stream = new ASN1InputStream(new ByteArrayInputStream(token)); DERApplicationSpecific derToken = ASN1Util.as(DERApplicationSpecific.class, stream); if ( derToken == null || !derToken.isConstructed() ) throw new PACDecodingException("Malformed kerberos token"); stream.close(); stream = new ASN1InputStream(new ByteArrayInputStream(derToken.getContents())); ASN1ObjectIdentifier kerberosOid = ASN1Util.as(ASN1ObjectIdentifier.class, stream); if ( !kerberosOid.getId().equals(KerberosConstants.KERBEROS_OID) ) throw new PACDecodingException("Not a kerberos token"); int read = 0; int readLow = stream.read() & 0xff; int readHigh = stream.read() & 0xff; read = ( readHigh << 8 ) + readLow; if ( read != 0x01 ) throw new PACDecodingException("Malformed kerberos token"); DERApplicationSpecific krbToken = ASN1Util.as(DERApplicationSpecific.class, stream); if ( krbToken == null || !krbToken.isConstructed() ) throw new PACDecodingException("Malformed kerberos token"); stream.close(); this.apRequest = new KerberosApRequest(krbToken.getContents(), keys); } catch ( IOException e ) { throw new PACDecodingException("Malformed kerberos token", e); } }