// KrbSafe, KrbTgsReq public Checksum(int new_cksumType, byte[] data, EncryptionKey key, int usage) throws KdcErrException, KrbApErrException, KrbCryptoException { cksumType = new_cksumType; CksumType cksumEngine = CksumType.getInstance(cksumType); if (!cksumEngine.isSafe()) throw new KrbApErrException(Krb5.KRB_AP_ERR_INAPP_CKSUM); checksum = cksumEngine.calculateKeyedChecksum(data, data.length, key.getBytes(), usage); }
/** Verifies the keyed checksum over the data passed in. */ public boolean verifyKeyedChecksum(byte[] data, EncryptionKey key, int usage) throws KdcErrException, KrbApErrException, KrbCryptoException { CksumType cksumEngine = CksumType.getInstance(cksumType); if (!cksumEngine.isSafe()) throw new KrbApErrException(Krb5.KRB_AP_ERR_INAPP_CKSUM); return cksumEngine.verifyKeyedChecksum(data, data.length, key.getBytes(), checksum, usage); }