Java Code Examples for sun.security.krb5.EncryptionKey#parse()

The following examples show how to use sun.security.krb5.EncryptionKey#parse() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EncKDCRepPart.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an EncKDCRepPart object.
 *
 * @param encoding a single DER-encoded value.
 * @param rep_type type of the encrypted reply message.
 * @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
 * @exception IOException if an I/O error occurs while reading encoded data.
 * @exception RealmException if an error occurs while decoding an Realm object.
 */
protected void init(DerValue encoding, int rep_type)
        throws Asn1Exception, IOException, RealmException {
    DerValue der, subDer;
    //implementations return the incorrect tag value, so
    //we don't use the above line; instead we use the following
    msgType = (encoding.getTag() & (byte) 0x1F);
    if (msgType != Krb5.KRB_ENC_AS_REP_PART &&
            msgType != Krb5.KRB_ENC_TGS_REP_PART) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    key = EncryptionKey.parse(der.getData(), (byte) 0x00, false);
    lastReq = LastReq.parse(der.getData(), (byte) 0x01, false);
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) == (byte) 0x02) {
        nonce = subDer.getData().getBigInteger().intValue();
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    keyExpiration = KerberosTime.parse(der.getData(), (byte) 0x03, true);
    flags = TicketFlags.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);
    renewTill = KerberosTime.parse(der.getData(), (byte) 0x08, true);
    Realm srealm = Realm.parse(der.getData(), (byte) 0x09, false);
    sname = PrincipalName.parse(der.getData(), (byte) 0x0A, false, srealm);
    if (der.getData().available() > 0) {
        caddr = HostAddresses.parse(der.getData(), (byte) 0x0B, true);
    }
    // We observe extra data from MSAD
    /*if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }*/
}
 
Example 2
Source File: EncKDCRepPart.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an EncKDCRepPart object.
 *
 * @param encoding a single DER-encoded value.
 * @param rep_type type of the encrypted reply message.
 * @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
 * @exception IOException if an I/O error occurs while reading encoded data.
 * @exception RealmException if an error occurs while decoding an Realm object.
 */
protected void init(DerValue encoding, int rep_type)
        throws Asn1Exception, IOException, RealmException {
    DerValue der, subDer;
    //implementations return the incorrect tag value, so
    //we don't use the above line; instead we use the following
    msgType = (encoding.getTag() & (byte) 0x1F);
    if (msgType != Krb5.KRB_ENC_AS_REP_PART &&
            msgType != Krb5.KRB_ENC_TGS_REP_PART) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    key = EncryptionKey.parse(der.getData(), (byte) 0x00, false);
    lastReq = LastReq.parse(der.getData(), (byte) 0x01, false);
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) == (byte) 0x02) {
        nonce = subDer.getData().getBigInteger().intValue();
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    keyExpiration = KerberosTime.parse(der.getData(), (byte) 0x03, true);
    flags = TicketFlags.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);
    renewTill = KerberosTime.parse(der.getData(), (byte) 0x08, true);
    Realm srealm = Realm.parse(der.getData(), (byte) 0x09, false);
    sname = PrincipalName.parse(der.getData(), (byte) 0x0A, false, srealm);
    if (der.getData().available() > 0) {
        caddr = HostAddresses.parse(der.getData(), (byte) 0x0B, true);
    }
    // We observe extra data from MSAD
    /*if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }*/
}
 
Example 3
Source File: EncKDCRepPart.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an EncKDCRepPart object.
 *
 * @param encoding a single DER-encoded value.
 * @param rep_type type of the encrypted reply message.
 * @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
 * @exception IOException if an I/O error occurs while reading encoded data.
 * @exception RealmException if an error occurs while decoding an Realm object.
 */
protected void init(DerValue encoding, int rep_type)
        throws Asn1Exception, IOException, RealmException {
    DerValue der, subDer;
    //implementations return the incorrect tag value, so
    //we don't use the above line; instead we use the following
    msgType = (encoding.getTag() & (byte) 0x1F);
    if (msgType != Krb5.KRB_ENC_AS_REP_PART &&
            msgType != Krb5.KRB_ENC_TGS_REP_PART) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    key = EncryptionKey.parse(der.getData(), (byte) 0x00, false);
    lastReq = LastReq.parse(der.getData(), (byte) 0x01, false);
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) == (byte) 0x02) {
        nonce = subDer.getData().getBigInteger().intValue();
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    keyExpiration = KerberosTime.parse(der.getData(), (byte) 0x03, true);
    flags = TicketFlags.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);
    renewTill = KerberosTime.parse(der.getData(), (byte) 0x08, true);
    Realm srealm = Realm.parse(der.getData(), (byte) 0x09, false);
    sname = PrincipalName.parse(der.getData(), (byte) 0x0A, false, srealm);
    if (der.getData().available() > 0) {
        caddr = HostAddresses.parse(der.getData(), (byte) 0x0B, true);
    }
    // We observe extra data from MSAD
    /*if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }*/
}
 
Example 4
Source File: EncKDCRepPart.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an EncKDCRepPart object.
 *
 * @param encoding a single DER-encoded value.
 * @param rep_type type of the encrypted reply message.
 * @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
 * @exception IOException if an I/O error occurs while reading encoded data.
 * @exception RealmException if an error occurs while decoding an Realm object.
 */
protected void init(DerValue encoding, int rep_type)
        throws Asn1Exception, IOException, RealmException {
    DerValue der, subDer;
    //implementations return the incorrect tag value, so
    //we don't use the above line; instead we use the following
    msgType = (encoding.getTag() & (byte) 0x1F);
    if (msgType != Krb5.KRB_ENC_AS_REP_PART &&
            msgType != Krb5.KRB_ENC_TGS_REP_PART) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    key = EncryptionKey.parse(der.getData(), (byte) 0x00, false);
    lastReq = LastReq.parse(der.getData(), (byte) 0x01, false);
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) == (byte) 0x02) {
        nonce = subDer.getData().getBigInteger().intValue();
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    keyExpiration = KerberosTime.parse(der.getData(), (byte) 0x03, true);
    flags = TicketFlags.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);
    renewTill = KerberosTime.parse(der.getData(), (byte) 0x08, true);
    Realm srealm = Realm.parse(der.getData(), (byte) 0x09, false);
    sname = PrincipalName.parse(der.getData(), (byte) 0x0A, false, srealm);
    if (der.getData().available() > 0) {
        caddr = HostAddresses.parse(der.getData(), (byte) 0x0B, true);
    }
    // We observe extra data from MSAD
    /*if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }*/
}
 
Example 5
Source File: EncKDCRepPart.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an EncKDCRepPart object.
 *
 * @param encoding a single DER-encoded value.
 * @param rep_type type of the encrypted reply message.
 * @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
 * @exception IOException if an I/O error occurs while reading encoded data.
 * @exception RealmException if an error occurs while decoding an Realm object.
 */
protected void init(DerValue encoding, int rep_type)
        throws Asn1Exception, IOException, RealmException {
    DerValue der, subDer;
    //implementations return the incorrect tag value, so
    //we don't use the above line; instead we use the following
    msgType = (encoding.getTag() & (byte) 0x1F);
    if (msgType != Krb5.KRB_ENC_AS_REP_PART &&
            msgType != Krb5.KRB_ENC_TGS_REP_PART) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    key = EncryptionKey.parse(der.getData(), (byte) 0x00, false);
    lastReq = LastReq.parse(der.getData(), (byte) 0x01, false);
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) == (byte) 0x02) {
        nonce = subDer.getData().getBigInteger().intValue();
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    keyExpiration = KerberosTime.parse(der.getData(), (byte) 0x03, true);
    flags = TicketFlags.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);
    renewTill = KerberosTime.parse(der.getData(), (byte) 0x08, true);
    Realm srealm = Realm.parse(der.getData(), (byte) 0x09, false);
    sname = PrincipalName.parse(der.getData(), (byte) 0x0A, false, srealm);
    if (der.getData().available() > 0) {
        caddr = HostAddresses.parse(der.getData(), (byte) 0x0B, true);
    }
    // We observe extra data from MSAD
    /*if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }*/
}
 
Example 6
Source File: EncKDCRepPart.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an EncKDCRepPart object.
 *
 * @param encoding a single DER-encoded value.
 * @param rep_type type of the encrypted reply message.
 * @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
 * @exception IOException if an I/O error occurs while reading encoded data.
 * @exception RealmException if an error occurs while decoding an Realm object.
 */
protected void init(DerValue encoding, int rep_type)
        throws Asn1Exception, IOException, RealmException {
    DerValue der, subDer;
    //implementations return the incorrect tag value, so
    //we don't use the above line; instead we use the following
    msgType = (encoding.getTag() & (byte) 0x1F);
    if (msgType != Krb5.KRB_ENC_AS_REP_PART &&
            msgType != Krb5.KRB_ENC_TGS_REP_PART) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    key = EncryptionKey.parse(der.getData(), (byte) 0x00, false);
    lastReq = LastReq.parse(der.getData(), (byte) 0x01, false);
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) == (byte) 0x02) {
        nonce = subDer.getData().getBigInteger().intValue();
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    keyExpiration = KerberosTime.parse(der.getData(), (byte) 0x03, true);
    flags = TicketFlags.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);
    renewTill = KerberosTime.parse(der.getData(), (byte) 0x08, true);
    Realm srealm = Realm.parse(der.getData(), (byte) 0x09, false);
    sname = PrincipalName.parse(der.getData(), (byte) 0x0A, false, srealm);
    if (der.getData().available() > 0) {
        caddr = HostAddresses.parse(der.getData(), (byte) 0x0B, true);
    }
    // We observe extra data from MSAD
    /*if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }*/
}
 
Example 7
Source File: EncKDCRepPart.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an EncKDCRepPart object.
 *
 * @param encoding a single DER-encoded value.
 * @param rep_type type of the encrypted reply message.
 * @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
 * @exception IOException if an I/O error occurs while reading encoded data.
 * @exception RealmException if an error occurs while decoding an Realm object.
 */
protected void init(DerValue encoding, int rep_type)
        throws Asn1Exception, IOException, RealmException {
    DerValue der, subDer;
    //implementations return the incorrect tag value, so
    //we don't use the above line; instead we use the following
    msgType = (encoding.getTag() & (byte) 0x1F);
    if (msgType != Krb5.KRB_ENC_AS_REP_PART &&
            msgType != Krb5.KRB_ENC_TGS_REP_PART) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    key = EncryptionKey.parse(der.getData(), (byte) 0x00, false);
    lastReq = LastReq.parse(der.getData(), (byte) 0x01, false);
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) == (byte) 0x02) {
        nonce = subDer.getData().getBigInteger().intValue();
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    keyExpiration = KerberosTime.parse(der.getData(), (byte) 0x03, true);
    flags = TicketFlags.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);
    renewTill = KerberosTime.parse(der.getData(), (byte) 0x08, true);
    Realm srealm = Realm.parse(der.getData(), (byte) 0x09, false);
    sname = PrincipalName.parse(der.getData(), (byte) 0x0A, false, srealm);
    if (der.getData().available() > 0) {
        caddr = HostAddresses.parse(der.getData(), (byte) 0x0B, true);
    }
    // We observe extra data from MSAD
    /*if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }*/
}
 
Example 8
Source File: EncKDCRepPart.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an EncKDCRepPart object.
 *
 * @param encoding a single DER-encoded value.
 * @param rep_type type of the encrypted reply message.
 * @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
 * @exception IOException if an I/O error occurs while reading encoded data.
 * @exception RealmException if an error occurs while decoding an Realm object.
 */
protected void init(DerValue encoding, int rep_type)
        throws Asn1Exception, IOException, RealmException {
    DerValue der, subDer;
    //implementations return the incorrect tag value, so
    //we don't use the above line; instead we use the following
    msgType = (encoding.getTag() & (byte) 0x1F);
    if (msgType != Krb5.KRB_ENC_AS_REP_PART &&
            msgType != Krb5.KRB_ENC_TGS_REP_PART) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    key = EncryptionKey.parse(der.getData(), (byte) 0x00, false);
    lastReq = LastReq.parse(der.getData(), (byte) 0x01, false);
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) == (byte) 0x02) {
        nonce = subDer.getData().getBigInteger().intValue();
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    keyExpiration = KerberosTime.parse(der.getData(), (byte) 0x03, true);
    flags = TicketFlags.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);
    renewTill = KerberosTime.parse(der.getData(), (byte) 0x08, true);
    Realm srealm = Realm.parse(der.getData(), (byte) 0x09, false);
    sname = PrincipalName.parse(der.getData(), (byte) 0x0A, false, srealm);
    if (der.getData().available() > 0) {
        caddr = HostAddresses.parse(der.getData(), (byte) 0x0B, true);
    }
    // We observe extra data from MSAD
    /*if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }*/
}
 
Example 9
Source File: EncKDCRepPart.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an EncKDCRepPart object.
 *
 * @param encoding a single DER-encoded value.
 * @param rep_type type of the encrypted reply message.
 * @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
 * @exception IOException if an I/O error occurs while reading encoded data.
 * @exception RealmException if an error occurs while decoding an Realm object.
 */
protected void init(DerValue encoding, int rep_type)
        throws Asn1Exception, IOException, RealmException {
    DerValue der, subDer;
    //implementations return the incorrect tag value, so
    //we don't use the above line; instead we use the following
    msgType = (encoding.getTag() & (byte) 0x1F);
    if (msgType != Krb5.KRB_ENC_AS_REP_PART &&
            msgType != Krb5.KRB_ENC_TGS_REP_PART) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    key = EncryptionKey.parse(der.getData(), (byte) 0x00, false);
    lastReq = LastReq.parse(der.getData(), (byte) 0x01, false);
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) == (byte) 0x02) {
        nonce = subDer.getData().getBigInteger().intValue();
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    keyExpiration = KerberosTime.parse(der.getData(), (byte) 0x03, true);
    flags = TicketFlags.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);
    renewTill = KerberosTime.parse(der.getData(), (byte) 0x08, true);
    Realm srealm = Realm.parse(der.getData(), (byte) 0x09, false);
    sname = PrincipalName.parse(der.getData(), (byte) 0x0A, false, srealm);
    if (der.getData().available() > 0) {
        caddr = HostAddresses.parse(der.getData(), (byte) 0x0B, true);
    }
    // We observe extra data from MSAD
    /*if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }*/
}