public byte[] decryptSeq(byte[] baseKey,int usage,byte[] checksum,byte[] ciphertext,int start,int len) throws GeneralSecurityException, KrbCryptoException {
  if (!KeyUsage.isValid(usage)) {
    throw new GeneralSecurityException("Invalid key usage number: " + usage);
  }
  byte[] salt=new byte[4];
  byte[] kSeq=getHmac(baseKey,salt);
  kSeq=getHmac(kSeq,checksum);
  Cipher cipher=Cipher.getInstance("ARCFOUR");
  SecretKeySpec secretKey=new SecretKeySpec(kSeq,"ARCFOUR");
  cipher.init(Cipher.DECRYPT_MODE,secretKey);
  byte[] output=cipher.doFinal(ciphertext,start,len);
  return output;
}

public byte [ ] decryptSeq ( byte [ ] baseKey , int usage , byte [ ] checksum , byte [ ] ciphertext , int start , int len ) throws GeneralSecurityException , KrbCryptoException { if ( ! KeyUsage . isValid ( usage ) ) { throw new GeneralSecurityException ( "Invalid key usage number: " + usage ) ; } byte [ ] salt = new byte [ 4 ] ; byte [ ] kSeq = getHmac ( baseKey , salt ) ; kSeq = getHmac ( kSeq , checksum ) ; Cipher cipher = Cipher . getInstance ( "ARCFOUR" ) ; SecretKeySpec secretKey = new SecretKeySpec ( kSeq , "ARCFOUR" ) ; cipher . init ( Cipher . DECRYPT_MODE , secretKey ) ; byte [ ] output = cipher . doFinal ( ciphertext , start , len ) ; return output ; }
performs decryption of sequence number using derived key .
