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

The following examples show how to use sun.security.krb5.EncryptedData#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: Ticket.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initializes a Ticket object.
 * @param encoding a single DER-encoded value.
 * @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 KrbApErrException if the value read from the DER-encoded data stream does not match the pre-defined value.
 * @exception RealmException if an error occurs while parsing a Realm object.
 */

private void init(DerValue encoding) throws Asn1Exception,
RealmException, KrbApErrException, IOException {
    DerValue der;
    DerValue subDer;
    if (((encoding.getTag() & (byte)0x1F) != Krb5.KRB_TKT)
        || (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);
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte)0x1F) != (byte)0x00)
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    tkt_vno = subDer.getData().getBigInteger().intValue();
    if (tkt_vno != Krb5.TICKET_VNO)
        throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
    Realm srealm = Realm.parse(der.getData(), (byte)0x01, false);
    sname = PrincipalName.parse(der.getData(), (byte)0x02, false, srealm);
    encPart = EncryptedData.parse(der.getData(), (byte)0x03, false);
    if (der.getData().available() > 0)
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
}
 
Example 2
Source File: Ticket.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initializes a Ticket object.
 * @param encoding a single DER-encoded value.
 * @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 KrbApErrException if the value read from the DER-encoded data stream does not match the pre-defined value.
 * @exception RealmException if an error occurs while parsing a Realm object.
 */

private void init(DerValue encoding) throws Asn1Exception,
RealmException, KrbApErrException, IOException {
    DerValue der;
    DerValue subDer;
    if (((encoding.getTag() & (byte)0x1F) != Krb5.KRB_TKT)
        || (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);
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte)0x1F) != (byte)0x00)
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    tkt_vno = subDer.getData().getBigInteger().intValue();
    if (tkt_vno != Krb5.TICKET_VNO)
        throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
    Realm srealm = Realm.parse(der.getData(), (byte)0x01, false);
    sname = PrincipalName.parse(der.getData(), (byte)0x02, false, srealm);
    encPart = EncryptedData.parse(der.getData(), (byte)0x03, false);
    if (der.getData().available() > 0)
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
}
 
Example 3
Source File: Ticket.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initializes a Ticket object.
 * @param encoding a single DER-encoded value.
 * @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 KrbApErrException if the value read from the DER-encoded data stream does not match the pre-defined value.
 * @exception RealmException if an error occurs while parsing a Realm object.
 */

private void init(DerValue encoding) throws Asn1Exception,
RealmException, KrbApErrException, IOException {
    DerValue der;
    DerValue subDer;
    if (((encoding.getTag() & (byte)0x1F) != Krb5.KRB_TKT)
        || (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);
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte)0x1F) != (byte)0x00)
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    tkt_vno = subDer.getData().getBigInteger().intValue();
    if (tkt_vno != Krb5.TICKET_VNO)
        throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
    Realm srealm = Realm.parse(der.getData(), (byte)0x01, false);
    sname = PrincipalName.parse(der.getData(), (byte)0x02, false, srealm);
    encPart = EncryptedData.parse(der.getData(), (byte)0x03, false);
    if (der.getData().available() > 0)
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
}
 
Example 4
Source File: Ticket.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initializes a Ticket object.
 * @param encoding a single DER-encoded value.
 * @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 KrbApErrException if the value read from the DER-encoded data stream does not match the pre-defined value.
 * @exception RealmException if an error occurs while parsing a Realm object.
 */

private void init(DerValue encoding) throws Asn1Exception,
RealmException, KrbApErrException, IOException {
    DerValue der;
    DerValue subDer;
    if (((encoding.getTag() & (byte)0x1F) != Krb5.KRB_TKT)
        || (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);
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte)0x1F) != (byte)0x00)
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    tkt_vno = subDer.getData().getBigInteger().intValue();
    if (tkt_vno != Krb5.TICKET_VNO)
        throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
    Realm srealm = Realm.parse(der.getData(), (byte)0x01, false);
    sname = PrincipalName.parse(der.getData(), (byte)0x02, false, srealm);
    encPart = EncryptedData.parse(der.getData(), (byte)0x03, false);
    if (der.getData().available() > 0)
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
}
 
Example 5
Source File: APRep.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an APRep object.
 * @param encoding a single DER-encoded value.
 * @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 KrbApErrException if the value read from the DER-encoded data
 *  stream does not match the pre-defined value.
 */
private void init(DerValue encoding) throws Asn1Exception,
        KrbApErrException, IOException {

    if (((encoding.getTag() & (byte) (0x1F)) != Krb5.KRB_AP_REP)
            || (encoding.isApplication() != true)
            || (encoding.isConstructed() != true)) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    DerValue der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    DerValue subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) != (byte) 0x00) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    pvno = subDer.getData().getBigInteger().intValue();
    if (pvno != Krb5.PVNO) {
        throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) != (byte) 0x01) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    msgType = subDer.getData().getBigInteger().intValue();
    if (msgType != Krb5.KRB_AP_REP) {
        throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
    }
    encPart = EncryptedData.parse(der.getData(), (byte) 0x02, false);
    if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
}
 
Example 6
Source File: APRep.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an APRep object.
 * @param encoding a single DER-encoded value.
 * @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 KrbApErrException if the value read from the DER-encoded data
 *  stream does not match the pre-defined value.
 */
private void init(DerValue encoding) throws Asn1Exception,
        KrbApErrException, IOException {

    if (((encoding.getTag() & (byte) (0x1F)) != Krb5.KRB_AP_REP)
            || (encoding.isApplication() != true)
            || (encoding.isConstructed() != true)) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    DerValue der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    DerValue subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) != (byte) 0x00) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    pvno = subDer.getData().getBigInteger().intValue();
    if (pvno != Krb5.PVNO) {
        throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) != (byte) 0x01) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    msgType = subDer.getData().getBigInteger().intValue();
    if (msgType != Krb5.KRB_AP_REP) {
        throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
    }
    encPart = EncryptedData.parse(der.getData(), (byte) 0x02, false);
    if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
}
 
Example 7
Source File: KRBPriv.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an KRBPriv object.
 * @param encoding a single DER-encoded value.
 * @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 KrbApErrException if the value read from the DER-encoded data
 *  stream does not match the pre-defined value.
 */
private void init(DerValue encoding) throws Asn1Exception,
KrbApErrException, IOException {
    DerValue der, subDer;
    if (((encoding.getTag() & (byte)0x1F) != (byte)0x15)
        || (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);
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x00) {
        pvno = subDer.getData().getBigInteger().intValue();
        if (pvno != Krb5.PVNO) {
            throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
        }
    }
    else
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x01) {
        msgType = subDer.getData().getBigInteger().intValue();
        if (msgType != Krb5.KRB_PRIV)
            throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
    }
    else
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    encPart = EncryptedData.parse(der.getData(), (byte)0x03, false);
    if (der.getData().available() >0)
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
}
 
Example 8
Source File: APRep.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an APRep object.
 * @param encoding a single DER-encoded value.
 * @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 KrbApErrException if the value read from the DER-encoded data
 *  stream does not match the pre-defined value.
 */
private void init(DerValue encoding) throws Asn1Exception,
        KrbApErrException, IOException {

    if (((encoding.getTag() & (byte) (0x1F)) != Krb5.KRB_AP_REP)
            || (encoding.isApplication() != true)
            || (encoding.isConstructed() != true)) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    DerValue der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    DerValue subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) != (byte) 0x00) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    pvno = subDer.getData().getBigInteger().intValue();
    if (pvno != Krb5.PVNO) {
        throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) != (byte) 0x01) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    msgType = subDer.getData().getBigInteger().intValue();
    if (msgType != Krb5.KRB_AP_REP) {
        throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
    }
    encPart = EncryptedData.parse(der.getData(), (byte) 0x02, false);
    if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
}
 
Example 9
Source File: APRep.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an APRep object.
 * @param encoding a single DER-encoded value.
 * @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 KrbApErrException if the value read from the DER-encoded data
 *  stream does not match the pre-defined value.
 */
private void init(DerValue encoding) throws Asn1Exception,
        KrbApErrException, IOException {

    if (((encoding.getTag() & (byte) (0x1F)) != Krb5.KRB_AP_REP)
            || (encoding.isApplication() != true)
            || (encoding.isConstructed() != true)) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    DerValue der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    DerValue subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) != (byte) 0x00) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    pvno = subDer.getData().getBigInteger().intValue();
    if (pvno != Krb5.PVNO) {
        throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) != (byte) 0x01) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    msgType = subDer.getData().getBigInteger().intValue();
    if (msgType != Krb5.KRB_AP_REP) {
        throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
    }
    encPart = EncryptedData.parse(der.getData(), (byte) 0x02, false);
    if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
}
 
Example 10
Source File: KRBPriv.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an KRBPriv object.
 * @param encoding a single DER-encoded value.
 * @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 KrbApErrException if the value read from the DER-encoded data
 *  stream does not match the pre-defined value.
 */
private void init(DerValue encoding) throws Asn1Exception,
KrbApErrException, IOException {
    DerValue der, subDer;
    if (((encoding.getTag() & (byte)0x1F) != (byte)0x15)
        || (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);
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x00) {
        pvno = subDer.getData().getBigInteger().intValue();
        if (pvno != Krb5.PVNO) {
            throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
        }
    }
    else
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x01) {
        msgType = subDer.getData().getBigInteger().intValue();
        if (msgType != Krb5.KRB_PRIV)
            throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
    }
    else
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    encPart = EncryptedData.parse(der.getData(), (byte)0x03, false);
    if (der.getData().available() >0)
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
}
 
Example 11
Source File: KRBPriv.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an KRBPriv object.
 * @param encoding a single DER-encoded value.
 * @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 KrbApErrException if the value read from the DER-encoded data
 *  stream does not match the pre-defined value.
 */
private void init(DerValue encoding) throws Asn1Exception,
KrbApErrException, IOException {
    DerValue der, subDer;
    if (((encoding.getTag() & (byte)0x1F) != (byte)0x15)
        || (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);
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x00) {
        pvno = subDer.getData().getBigInteger().intValue();
        if (pvno != Krb5.PVNO) {
            throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
        }
    }
    else
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x01) {
        msgType = subDer.getData().getBigInteger().intValue();
        if (msgType != Krb5.KRB_PRIV)
            throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
    }
    else
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    encPart = EncryptedData.parse(der.getData(), (byte)0x03, false);
    if (der.getData().available() >0)
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
}
 
Example 12
Source File: APRep.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an APRep object.
 * @param encoding a single DER-encoded value.
 * @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 KrbApErrException if the value read from the DER-encoded data
 *  stream does not match the pre-defined value.
 */
private void init(DerValue encoding) throws Asn1Exception,
        KrbApErrException, IOException {

    if (((encoding.getTag() & (byte) (0x1F)) != Krb5.KRB_AP_REP)
            || (encoding.isApplication() != true)
            || (encoding.isConstructed() != true)) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    DerValue der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    DerValue subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) != (byte) 0x00) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    pvno = subDer.getData().getBigInteger().intValue();
    if (pvno != Krb5.PVNO) {
        throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) != (byte) 0x01) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    msgType = subDer.getData().getBigInteger().intValue();
    if (msgType != Krb5.KRB_AP_REP) {
        throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
    }
    encPart = EncryptedData.parse(der.getData(), (byte) 0x02, false);
    if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
}
 
Example 13
Source File: APRep.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an APRep object.
 * @param encoding a single DER-encoded value.
 * @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 KrbApErrException if the value read from the DER-encoded data
 *  stream does not match the pre-defined value.
 */
private void init(DerValue encoding) throws Asn1Exception,
        KrbApErrException, IOException {

    if (((encoding.getTag() & (byte) (0x1F)) != Krb5.KRB_AP_REP)
            || (encoding.isApplication() != true)
            || (encoding.isConstructed() != true)) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    DerValue der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    DerValue subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) != (byte) 0x00) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    pvno = subDer.getData().getBigInteger().intValue();
    if (pvno != Krb5.PVNO) {
        throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) != (byte) 0x01) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    msgType = subDer.getData().getBigInteger().intValue();
    if (msgType != Krb5.KRB_AP_REP) {
        throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
    }
    encPart = EncryptedData.parse(der.getData(), (byte) 0x02, false);
    if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
}
 
Example 14
Source File: APRep.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an APRep object.
 * @param encoding a single DER-encoded value.
 * @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 KrbApErrException if the value read from the DER-encoded data
 *  stream does not match the pre-defined value.
 */
private void init(DerValue encoding) throws Asn1Exception,
        KrbApErrException, IOException {

    if (((encoding.getTag() & (byte) (0x1F)) != Krb5.KRB_AP_REP)
            || (encoding.isApplication() != true)
            || (encoding.isConstructed() != true)) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    DerValue der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    DerValue subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) != (byte) 0x00) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    pvno = subDer.getData().getBigInteger().intValue();
    if (pvno != Krb5.PVNO) {
        throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & (byte) 0x1F) != (byte) 0x01) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    msgType = subDer.getData().getBigInteger().intValue();
    if (msgType != Krb5.KRB_AP_REP) {
        throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
    }
    encPart = EncryptedData.parse(der.getData(), (byte) 0x02, false);
    if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
}
 
Example 15
Source File: KRBCred.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Initializes an KRBCred object.
 * @param encoding a single DER-encoded value.
 * @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 KrbApErrException if the value read from the DER-encoded data
 *  stream does not match the pre-defined value.
 * @exception RealmException if an error occurs while parsing a Realm object.
 */
private void init(DerValue encoding) throws Asn1Exception,
        RealmException, KrbApErrException, IOException {
    if (((encoding.getTag() & (byte) 0x1F) != (byte) 0x16)
            || (encoding.isApplication() != true)
            || (encoding.isConstructed() != true)) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    DerValue der, subDer;
    der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x00) {
        pvno = subDer.getData().getBigInteger().intValue();
        if (pvno != Krb5.PVNO) {
            throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
        }
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x01) {
        msgType = subDer.getData().getBigInteger().intValue();
        if (msgType != Krb5.KRB_CRED) {
            throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
        }
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x02) {
        DerValue subsubDer = subDer.getData().getDerValue();
        if (subsubDer.getTag() != DerValue.tag_SequenceOf) {
            throw new Asn1Exception(Krb5.ASN1_BAD_ID);
        }
        Vector<Ticket> v = new Vector<>();
        while (subsubDer.getData().available() > 0) {
            v.addElement(new Ticket(subsubDer.getData().getDerValue()));
        }
        if (v.size() > 0) {
            tickets = new Ticket[v.size()];
            v.copyInto(tickets);
        }
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    encPart = EncryptedData.parse(der.getData(), (byte) 0x03, false);

    if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
}
 
Example 16
Source File: KRBCred.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Initializes an KRBCred object.
 * @param encoding a single DER-encoded value.
 * @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 KrbApErrException if the value read from the DER-encoded data
 *  stream does not match the pre-defined value.
 * @exception RealmException if an error occurs while parsing a Realm object.
 */
private void init(DerValue encoding) throws Asn1Exception,
        RealmException, KrbApErrException, IOException {
    if (((encoding.getTag() & (byte) 0x1F) != (byte) 0x16)
            || (encoding.isApplication() != true)
            || (encoding.isConstructed() != true)) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    DerValue der, subDer;
    der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x00) {
        pvno = subDer.getData().getBigInteger().intValue();
        if (pvno != Krb5.PVNO) {
            throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
        }
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x01) {
        msgType = subDer.getData().getBigInteger().intValue();
        if (msgType != Krb5.KRB_CRED) {
            throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
        }
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x02) {
        DerValue subsubDer = subDer.getData().getDerValue();
        if (subsubDer.getTag() != DerValue.tag_SequenceOf) {
            throw new Asn1Exception(Krb5.ASN1_BAD_ID);
        }
        Vector<Ticket> v = new Vector<>();
        while (subsubDer.getData().available() > 0) {
            v.addElement(new Ticket(subsubDer.getData().getDerValue()));
        }
        if (v.size() > 0) {
            tickets = new Ticket[v.size()];
            v.copyInto(tickets);
        }
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    encPart = EncryptedData.parse(der.getData(), (byte) 0x03, false);

    if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
}
 
Example 17
Source File: KRBCred.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Initializes an KRBCred object.
 * @param encoding a single DER-encoded value.
 * @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 KrbApErrException if the value read from the DER-encoded data
 *  stream does not match the pre-defined value.
 * @exception RealmException if an error occurs while parsing a Realm object.
 */
private void init(DerValue encoding) throws Asn1Exception,
        RealmException, KrbApErrException, IOException {
    if (((encoding.getTag() & (byte) 0x1F) != (byte) 0x16)
            || (encoding.isApplication() != true)
            || (encoding.isConstructed() != true)) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    DerValue der, subDer;
    der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x00) {
        pvno = subDer.getData().getBigInteger().intValue();
        if (pvno != Krb5.PVNO) {
            throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
        }
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x01) {
        msgType = subDer.getData().getBigInteger().intValue();
        if (msgType != Krb5.KRB_CRED) {
            throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
        }
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x02) {
        DerValue subsubDer = subDer.getData().getDerValue();
        if (subsubDer.getTag() != DerValue.tag_SequenceOf) {
            throw new Asn1Exception(Krb5.ASN1_BAD_ID);
        }
        Vector<Ticket> v = new Vector<>();
        while (subsubDer.getData().available() > 0) {
            v.addElement(new Ticket(subsubDer.getData().getDerValue()));
        }
        if (v.size() > 0) {
            tickets = new Ticket[v.size()];
            v.copyInto(tickets);
        }
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    encPart = EncryptedData.parse(der.getData(), (byte) 0x03, false);

    if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
}
 
Example 18
Source File: KRBCred.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Initializes an KRBCred object.
 * @param encoding a single DER-encoded value.
 * @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 KrbApErrException if the value read from the DER-encoded data
 *  stream does not match the pre-defined value.
 * @exception RealmException if an error occurs while parsing a Realm object.
 */
private void init(DerValue encoding) throws Asn1Exception,
        RealmException, KrbApErrException, IOException {
    if (((encoding.getTag() & (byte) 0x1F) != (byte) 0x16)
            || (encoding.isApplication() != true)
            || (encoding.isConstructed() != true)) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    DerValue der, subDer;
    der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x00) {
        pvno = subDer.getData().getBigInteger().intValue();
        if (pvno != Krb5.PVNO) {
            throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
        }
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x01) {
        msgType = subDer.getData().getBigInteger().intValue();
        if (msgType != Krb5.KRB_CRED) {
            throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
        }
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x02) {
        DerValue subsubDer = subDer.getData().getDerValue();
        if (subsubDer.getTag() != DerValue.tag_SequenceOf) {
            throw new Asn1Exception(Krb5.ASN1_BAD_ID);
        }
        Vector<Ticket> v = new Vector<>();
        while (subsubDer.getData().available() > 0) {
            v.addElement(new Ticket(subsubDer.getData().getDerValue()));
        }
        if (v.size() > 0) {
            tickets = new Ticket[v.size()];
            v.copyInto(tickets);
        }
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    encPart = EncryptedData.parse(der.getData(), (byte) 0x03, false);

    if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
}
 
Example 19
Source File: KRBCred.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Initializes an KRBCred object.
 * @param encoding a single DER-encoded value.
 * @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 KrbApErrException if the value read from the DER-encoded data
 *  stream does not match the pre-defined value.
 * @exception RealmException if an error occurs while parsing a Realm object.
 */
private void init(DerValue encoding) throws Asn1Exception,
        RealmException, KrbApErrException, IOException {
    if (((encoding.getTag() & (byte) 0x1F) != (byte) 0x16)
            || (encoding.isApplication() != true)
            || (encoding.isConstructed() != true)) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    DerValue der, subDer;
    der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x00) {
        pvno = subDer.getData().getBigInteger().intValue();
        if (pvno != Krb5.PVNO) {
            throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
        }
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x01) {
        msgType = subDer.getData().getBigInteger().intValue();
        if (msgType != Krb5.KRB_CRED) {
            throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
        }
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x02) {
        DerValue subsubDer = subDer.getData().getDerValue();
        if (subsubDer.getTag() != DerValue.tag_SequenceOf) {
            throw new Asn1Exception(Krb5.ASN1_BAD_ID);
        }
        Vector<Ticket> v = new Vector<>();
        while (subsubDer.getData().available() > 0) {
            v.addElement(new Ticket(subsubDer.getData().getDerValue()));
        }
        if (v.size() > 0) {
            tickets = new Ticket[v.size()];
            v.copyInto(tickets);
        }
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    encPart = EncryptedData.parse(der.getData(), (byte) 0x03, false);

    if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
}
 
Example 20
Source File: KRBCred.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Initializes an KRBCred object.
 * @param encoding a single DER-encoded value.
 * @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 KrbApErrException if the value read from the DER-encoded data
 *  stream does not match the pre-defined value.
 * @exception RealmException if an error occurs while parsing a Realm object.
 */
private void init(DerValue encoding) throws Asn1Exception,
        RealmException, KrbApErrException, IOException {
    if (((encoding.getTag() & (byte) 0x1F) != (byte) 0x16)
            || (encoding.isApplication() != true)
            || (encoding.isConstructed() != true)) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    DerValue der, subDer;
    der = encoding.getData().getDerValue();
    if (der.getTag() != DerValue.tag_Sequence) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x00) {
        pvno = subDer.getData().getBigInteger().intValue();
        if (pvno != Krb5.PVNO) {
            throw new KrbApErrException(Krb5.KRB_AP_ERR_BADVERSION);
        }
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x01) {
        msgType = subDer.getData().getBigInteger().intValue();
        if (msgType != Krb5.KRB_CRED) {
            throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
        }
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    subDer = der.getData().getDerValue();
    if ((subDer.getTag() & 0x1F) == 0x02) {
        DerValue subsubDer = subDer.getData().getDerValue();
        if (subsubDer.getTag() != DerValue.tag_SequenceOf) {
            throw new Asn1Exception(Krb5.ASN1_BAD_ID);
        }
        Vector<Ticket> v = new Vector<>();
        while (subsubDer.getData().available() > 0) {
            v.addElement(new Ticket(subsubDer.getData().getDerValue()));
        }
        if (v.size() > 0) {
            tickets = new Ticket[v.size()];
            v.copyInto(tickets);
        }
    } else {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
    encPart = EncryptedData.parse(der.getData(), (byte) 0x03, false);

    if (der.getData().available() > 0) {
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    }
}