本文整理汇总了Java中sun.security.krb5.Checksum类的典型用法代码示例。如果您正苦于以下问题:Java Checksum类的具体用法?Java Checksum怎么用?Java Checksum使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Checksum类属于sun.security.krb5包,在下文中一共展示了Checksum类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInstance
import sun.security.krb5.Checksum; //导入依赖的package包/类
/**
* 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);
}
示例2: getInstance
import sun.security.krb5.Checksum; //导入依赖的package包/类
/**
* 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 = (c.getType(c.getDefault("ap_req_checksum_type",
"libdefaults")))) == - 1) {
if ((cksumType = c.getType(c.getDefault("checksum_type",
"libdefaults"))) == -1) {
cksumType = Checksum.CKSUMTYPE_RSA_MD5; // default
}
}
} catch (KrbException e) {
}
return getInstance(cksumType);
}
示例3: init
import sun.security.krb5.Checksum; //导入依赖的package包/类
/**
* 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);
}
示例4: KRBError
import sun.security.krb5.Checksum; //导入依赖的package包/类
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);
}
示例5: validatePacSignature
import sun.security.krb5.Checksum; //导入依赖的package包/类
public boolean validatePacSignature(EncryptionKey serverPrivateKey, byte[] PacBytes, PacSignatureData pacServerChecksum) throws KdcErrException, KrbApErrException, KrbCryptoException {
Checksum checksum = new Checksum(pacServerChecksum.getSignatureType(), PacBytes, serverPrivateKey, PacConstants.KERB_NON_KERB_CKSUM_SALT);
byte[] validationSignature = checksum.getBytes();
if (Arrays.equals(validationSignature, pacServerChecksum.getSignatureBytes())) {
return true;
}
return false;
}
示例6: process
import sun.security.krb5.Checksum; //导入依赖的package包/类
@Override
public void process(int pacInfoBufferType, byte[] pacInfoBufferBytes) throws IOException {
super.process(pacInfoBufferType, pacInfoBufferBytes);
ByteBuffer pacDataStream = ByteBuffer.wrap(pacInfoBufferBytes);
pacDataStream.order(ByteOrder.LITTLE_ENDIAN);
this.signatureType = pacDataStream.getInt();
int signatureSize = 0;
switch (signatureType) {
case Checksum.CKSUMTYPE_HMAC_MD5_ARCFOUR:
signatureSize = 16;
break;
case Checksum.CKSUMTYPE_HMAC_SHA1_96_AES128:
signatureSize = 12;
break;
case Checksum.CKSUMTYPE_HMAC_SHA1_96_AES256:
signatureSize = 12;
break;
default:
throw new IOException("PAC signature using unknown encryption algorithm");
}
int sigStartPosition = pacDataStream.position();
byte[] sigBytes = new byte[signatureSize];
pacDataStream.get(sigBytes);
this.signatureBytes = sigBytes;;
for (int i=0; i < signatureSize; i++){
pacInfoBufferBytes[sigStartPosition + i] = (byte)0;
}
this.zeroedSignaturePacSignatureData = pacInfoBufferBytes;
//short rodcIdentifier = pacDataStream.getShort();
}
示例7: KRBError
import sun.security.krb5.Checksum; //导入依赖的package包/类
public KRBError(
APOptions new_apOptions,
KerberosTime new_cTime,
Integer new_cuSec,
KerberosTime new_sTime,
Integer new_suSec,
int new_errorCode,
Realm new_crealm,
PrincipalName new_cname,
Realm new_realm,
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_crealm;
cname = new_cname;
realm = new_realm;
sname = new_sname;
eText = new_eText;
eData = new_eData;
eCksum = new_eCksum;
parseEData(eData);
}