sun.security.krb5.Checksum Java Examples

The following examples show how to use sun.security.krb5.Checksum. 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: CksumType.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns default checksum type.
 */
public static CksumType getInstance() throws KdcErrException {
    // this method provided for Kerberos applications.
    int cksumType = Checksum.CKSUMTYPE_RSA_MD5; // default
    try {
        Config c = Config.getInstance();
        if ((cksumType = (Config.getType(c.get("libdefaults",
                "ap_req_checksum_type")))) == - 1) {
            if ((cksumType = Config.getType(c.get("libdefaults",
                    "checksum_type"))) == -1) {
                cksumType = Checksum.CKSUMTYPE_RSA_MD5; // default
            }
        }
    } catch (KrbException e) {
    }
    return getInstance(cksumType);
}
 
Example #2
Source File: CksumType.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns default checksum type.
 */
public static CksumType getInstance() throws KdcErrException {
    // this method provided for Kerberos applications.
    int cksumType = Checksum.CKSUMTYPE_RSA_MD5; // default
    try {
        Config c = Config.getInstance();
        if ((cksumType = (Config.getType(c.get("libdefaults",
                "ap_req_checksum_type")))) == - 1) {
            if ((cksumType = Config.getType(c.get("libdefaults",
                    "checksum_type"))) == -1) {
                cksumType = Checksum.CKSUMTYPE_RSA_MD5; // default
            }
        }
    } catch (KrbException e) {
    }
    return getInstance(cksumType);
}
 
Example #3
Source File: KRBError.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public KRBError(
                APOptions new_apOptions,
                KerberosTime new_cTime,
                Integer new_cuSec,
                KerberosTime new_sTime,
                Integer new_suSec,
                int new_errorCode,
                PrincipalName new_cname,
                PrincipalName new_sname,
                String new_eText,
                byte[] new_eData,
                Checksum new_eCksum
                    ) throws IOException, Asn1Exception {
    pvno = Krb5.PVNO;
    msgType = Krb5.KRB_ERROR;
    cTime = new_cTime;
    cuSec = new_cuSec;
    sTime = new_sTime;
    suSec = new_suSec;
    errorCode = new_errorCode;
    cname = new_cname;
    sname = new_sname;
    eText = new_eText;
    eData = new_eData;
    eCksum = new_eCksum;

    parseEData(eData);
}
 
Example #4
Source File: KRBSafe.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an KRBSafe 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 RealmException if an error occurs while parsing a Realm object.
 * @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,
RealmException, KrbApErrException, IOException {
    DerValue der, subDer;
    if (((encoding.getTag() & (byte)0x1F) != (byte)0x14)
        || (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_SAFE)
            throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
    }

    else
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    safeBody = KRBSafeBody.parse(der.getData(), (byte)0x02, false);
    cksum = Checksum.parse(der.getData(), (byte)0x03, false);
    if (der.getData().available() > 0)
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
}
 
Example #5
Source File: KRBSafe.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an KRBSafe 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 RealmException if an error occurs while parsing a Realm object.
 * @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,
RealmException, KrbApErrException, IOException {
    DerValue der, subDer;
    if (((encoding.getTag() & (byte)0x1F) != (byte)0x14)
        || (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_SAFE)
            throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
    }

    else
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    safeBody = KRBSafeBody.parse(der.getData(), (byte)0x02, false);
    cksum = Checksum.parse(der.getData(), (byte)0x03, false);
    if (der.getData().available() > 0)
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
}
 
Example #6
Source File: KRBError.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public KRBError(
                APOptions new_apOptions,
                KerberosTime new_cTime,
                Integer new_cuSec,
                KerberosTime new_sTime,
                Integer new_suSec,
                int new_errorCode,
                PrincipalName new_cname,
                PrincipalName new_sname,
                String new_eText,
                byte[] new_eData,
                Checksum new_eCksum
                    ) throws IOException, Asn1Exception {
    pvno = Krb5.PVNO;
    msgType = Krb5.KRB_ERROR;
    cTime = new_cTime;
    cuSec = new_cuSec;
    sTime = new_sTime;
    suSec = new_suSec;
    errorCode = new_errorCode;
    cname = new_cname;
    sname = new_sname;
    eText = new_eText;
    eData = new_eData;
    eCksum = new_eCksum;

    parseEData(eData);
}
 
Example #7
Source File: KRBSafe.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an KRBSafe 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 RealmException if an error occurs while parsing a Realm object.
 * @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,
RealmException, KrbApErrException, IOException {
    DerValue der, subDer;
    if (((encoding.getTag() & (byte)0x1F) != (byte)0x14)
        || (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_SAFE)
            throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
    }

    else
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    safeBody = KRBSafeBody.parse(der.getData(), (byte)0x02, false);
    cksum = Checksum.parse(der.getData(), (byte)0x03, false);
    if (der.getData().available() > 0)
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
}
 
Example #8
Source File: KRBError.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public KRBError(
                APOptions new_apOptions,
                KerberosTime new_cTime,
                Integer new_cuSec,
                KerberosTime new_sTime,
                Integer new_suSec,
                int new_errorCode,
                PrincipalName new_cname,
                PrincipalName new_sname,
                String new_eText,
                byte[] new_eData,
                Checksum new_eCksum
                    ) throws IOException, Asn1Exception {
    pvno = Krb5.PVNO;
    msgType = Krb5.KRB_ERROR;
    cTime = new_cTime;
    cuSec = new_cuSec;
    sTime = new_sTime;
    suSec = new_suSec;
    errorCode = new_errorCode;
    crealm = new_cname != null ? new_cname.getRealm() : null;
    cname = new_cname;
    sname = new_sname;
    eText = new_eText;
    eData = new_eData;
    eCksum = new_eCksum;

    parseEData(eData);
}
 
Example #9
Source File: KRBSafe.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an KRBSafe 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 RealmException if an error occurs while parsing a Realm object.
 * @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,
RealmException, KrbApErrException, IOException {
    DerValue der, subDer;
    if (((encoding.getTag() & (byte)0x1F) != (byte)0x14)
        || (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_SAFE)
            throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
    }

    else
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    safeBody = KRBSafeBody.parse(der.getData(), (byte)0x02, false);
    cksum = Checksum.parse(der.getData(), (byte)0x03, false);
    if (der.getData().available() > 0)
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
}
 
Example #10
Source File: KRBSafe.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes an KRBSafe 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 RealmException if an error occurs while parsing a Realm object.
 * @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,
RealmException, KrbApErrException, IOException {
    DerValue der, subDer;
    if (((encoding.getTag() & (byte)0x1F) != (byte)0x14)
        || (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_SAFE)
            throw new KrbApErrException(Krb5.KRB_AP_ERR_MSG_TYPE);
    }

    else
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
    safeBody = KRBSafeBody.parse(der.getData(), (byte)0x02, false);
    cksum = Checksum.parse(der.getData(), (byte)0x03, false);
    if (der.getData().available() > 0)
        throw new Asn1Exception(Krb5.ASN1_BAD_ID);
}
 
Example #11
Source File: HmacSha1Aes256CksumType.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public int cksumType() {
    return Checksum.CKSUMTYPE_HMAC_SHA1_96_AES256;
}
 
Example #12
Source File: CksumType.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static CksumType getInstance(int cksumTypeConst)
    throws KdcErrException {
    CksumType cksumType = null;
    String cksumTypeName = null;
    switch (cksumTypeConst) {
    case Checksum.CKSUMTYPE_CRC32:
        cksumType = new Crc32CksumType();
        cksumTypeName = "sun.security.krb5.internal.crypto.Crc32CksumType";
        break;
    case Checksum.CKSUMTYPE_DES_MAC:
        cksumType = new DesMacCksumType();
        cksumTypeName = "sun.security.krb5.internal.crypto.DesMacCksumType";
        break;
    case Checksum.CKSUMTYPE_DES_MAC_K:
        cksumType = new DesMacKCksumType();
        cksumTypeName =
            "sun.security.krb5.internal.crypto.DesMacKCksumType";
        break;
    case Checksum.CKSUMTYPE_RSA_MD5:
        cksumType = new RsaMd5CksumType();
        cksumTypeName = "sun.security.krb5.internal.crypto.RsaMd5CksumType";
        break;
    case Checksum.CKSUMTYPE_RSA_MD5_DES:
        cksumType = new RsaMd5DesCksumType();
        cksumTypeName =
            "sun.security.krb5.internal.crypto.RsaMd5DesCksumType";
        break;

    case Checksum.CKSUMTYPE_HMAC_SHA1_DES3_KD:
        cksumType = new HmacSha1Des3KdCksumType();
        cksumTypeName =
            "sun.security.krb5.internal.crypto.HmacSha1Des3KdCksumType";
        break;

    case Checksum.CKSUMTYPE_HMAC_SHA1_96_AES128:
        cksumType = new HmacSha1Aes128CksumType();
        cksumTypeName =
            "sun.security.krb5.internal.crypto.HmacSha1Aes128CksumType";
        break;

    case Checksum.CKSUMTYPE_HMAC_SHA1_96_AES256:
        cksumType = new HmacSha1Aes256CksumType();
        cksumTypeName =
            "sun.security.krb5.internal.crypto.HmacSha1Aes256CksumType";
        break;

    case Checksum.CKSUMTYPE_HMAC_MD5_ARCFOUR:
        cksumType = new HmacMd5ArcFourCksumType();
        cksumTypeName =
            "sun.security.krb5.internal.crypto.HmacMd5ArcFourCksumType";
        break;

        // currently we don't support MD4.
    case Checksum.CKSUMTYPE_RSA_MD4_DES_K:
        // cksumType = new RsaMd4DesKCksumType();
        // cksumTypeName =
        //          "sun.security.krb5.internal.crypto.RsaMd4DesKCksumType";
    case Checksum.CKSUMTYPE_RSA_MD4:
        // cksumType = new RsaMd4CksumType();
        // linux box support rsamd4, how to solve conflict?
        // cksumTypeName =
        //          "sun.security.krb5.internal.crypto.RsaMd4CksumType";
    case Checksum.CKSUMTYPE_RSA_MD4_DES:
        // cksumType = new RsaMd4DesCksumType();
        // cksumTypeName =
        //          "sun.security.krb5.internal.crypto.RsaMd4DesCksumType";

    default:
        throw new KdcErrException(Krb5.KDC_ERR_SUMTYPE_NOSUPP);
    }
    if (DEBUG) {
        System.out.println(">>> CksumType: " + cksumTypeName);
    }
    return cksumType;
}
 
Example #13
Source File: DesMacCksumType.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public int cksumType() {
    return Checksum.CKSUMTYPE_DES_MAC;
}
 
Example #14
Source File: HmacSha1Aes128CksumType.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public int cksumType() {
    return Checksum.CKSUMTYPE_HMAC_SHA1_96_AES128;
}
 
Example #15
Source File: HmacSha1Des3KdCksumType.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public int cksumType() {
    return Checksum.CKSUMTYPE_HMAC_SHA1_DES3_KD;
}
 
Example #16
Source File: HmacSha1Aes128CksumType.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public int cksumType() {
    return Checksum.CKSUMTYPE_HMAC_SHA1_96_AES128;
}
 
Example #17
Source File: HmacSha1Aes128CksumType.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public int cksumType() {
    return Checksum.CKSUMTYPE_HMAC_SHA1_96_AES128;
}
 
Example #18
Source File: HmacSha1Des3KdCksumType.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public int cksumType() {
    return Checksum.CKSUMTYPE_HMAC_SHA1_DES3_KD;
}
 
Example #19
Source File: RsaMd5CksumType.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public int cksumType() {
    return Checksum.CKSUMTYPE_RSA_MD5;
}
 
Example #20
Source File: RsaMd5CksumType.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public int cksumType() {
    return Checksum.CKSUMTYPE_RSA_MD5;
}
 
Example #21
Source File: Aes128CtsHmacSha1EType.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public int checksumType() {
    return Checksum.CKSUMTYPE_HMAC_SHA1_96_AES128;
}
 
Example #22
Source File: HmacSha1Aes256CksumType.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public int cksumType() {
    return Checksum.CKSUMTYPE_HMAC_SHA1_96_AES256;
}
 
Example #23
Source File: HmacMd5ArcFourCksumType.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public int cksumType() {
    return Checksum.CKSUMTYPE_HMAC_MD5_ARCFOUR;
}
 
Example #24
Source File: DesMacKCksumType.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public int cksumType() {
    return Checksum.CKSUMTYPE_DES_MAC_K;
}
 
Example #25
Source File: HmacSha1Aes256CksumType.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public int cksumType() {
    return Checksum.CKSUMTYPE_HMAC_SHA1_96_AES256;
}
 
Example #26
Source File: ArcFourHmacEType.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public int checksumType() {
    return Checksum.CKSUMTYPE_HMAC_MD5_ARCFOUR;
}
 
Example #27
Source File: ArcFourHmacEType.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public int checksumType() {
    return Checksum.CKSUMTYPE_HMAC_MD5_ARCFOUR;
}
 
Example #28
Source File: Aes256CtsHmacSha1EType.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public int checksumType() {
    return Checksum.CKSUMTYPE_HMAC_SHA1_96_AES256;
}
 
Example #29
Source File: HmacSha1Des3KdCksumType.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public int cksumType() {
    return Checksum.CKSUMTYPE_HMAC_SHA1_DES3_KD;
}
 
Example #30
Source File: DesCbcCrcEType.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public int checksumType() {
    return Checksum.CKSUMTYPE_CRC32;
}