public Init ( bool forEncryption, ICipherParameters parameters ) : void | ||
forEncryption | bool | |
parameters | ICipherParameters | |
리턴 | void |
public void Init(
bool forEncryption, //ignored by this CTR mode
ICipherParameters parameters)
{
if (parameters is ParametersWithIV)
{
ParametersWithIV ivParam = (ParametersWithIV) parameters;
byte[] iv = ivParam.GetIV();
Array.Copy(iv, 0, IV, 0, IV.Length);
Reset();
// if null it's an IV changed only.
if (ivParam.Parameters != null)
{
cipher.Init(true, ivParam.Parameters);
}
}
else
{
throw new ArgumentException("SIC mode requires ParametersWithIV", "parameters");
}
}
private SicBlockCipher CreateDecryptor(string key) { SicBlockCipher decryptor = new SicBlockCipher(aes); decryptor.Init(false, new ParametersWithIV(new KeyParameter(DecodeKey(key)), new byte[aes.GetBlockSize()])); return decryptor; }