本文整理汇总了Java中sun.security.krb5.internal.crypto.ArcFourHmac.decryptRaw方法的典型用法代码示例。如果您正苦于以下问题:Java ArcFourHmac.decryptRaw方法的具体用法?Java ArcFourHmac.decryptRaw怎么用?Java ArcFourHmac.decryptRaw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.security.krb5.internal.crypto.ArcFourHmac
的用法示例。
在下文中一共展示了ArcFourHmac.decryptRaw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: arcFourDecrypt
import sun.security.krb5.internal.crypto.ArcFourHmac; //导入方法依赖的package包/类
private void arcFourDecrypt(WrapToken token, byte[] ciphertext,
int cStart, int cLen, byte[] plaintext, int pStart)
throws GSSException {
// obtain Sequence number needed for decryption
// first decrypt the Sequence Number using checksum
byte[] seqNum = decryptSeq(token.getChecksum(),
token.getEncSeqNumber(), 0, 8);
byte[] ptext;
try {
ptext = ArcFourHmac.decryptRaw(keybytes, KG_USAGE_SEAL, ZERO_IV,
ciphertext, cStart, cLen, seqNum);
} catch (GeneralSecurityException e) {
GSSException ge = new GSSException(GSSException.FAILURE, -1,
"Could not use ArcFour Cipher - " + e.getMessage());
ge.initCause(e);
throw ge;
}
/*
Krb5Token.debug("\narcFourDecrypt in: " +
Krb5Token.getHexBytes(ciphertext, cStart, cLen));
Krb5Token.debug("\narcFourDecrypt plain: " +
Krb5Token.getHexBytes(ptext));
*/
// Strip out confounder and padding
/*
* There is always at least one padding byte. The padding bytes
* are all the value of the number of padding bytes.
*/
int padSize = ptext[ptext.length - 1];
if (padSize < 1)
throw new GSSException(GSSException.DEFECTIVE_TOKEN, -1,
"Invalid padding on Wrap Token");
token.padding = WrapToken.pads[padSize];
int len = ptext.length - WrapToken.CONFOUNDER_SIZE - padSize;
System.arraycopy(ptext, WrapToken.CONFOUNDER_SIZE,
plaintext, pStart, len);
// Krb5Token.debug("\narcFourDecrypt plaintext: " +
// Krb5Token.getHexBytes(plaintext));
// Needed to calculate checksum
System.arraycopy(ptext, 0, token.confounder,
0, WrapToken.CONFOUNDER_SIZE);
}