CreateIV() приватный статический Метод

private static CreateIV ( SecureRandom random, int ivLength ) : byte[]
random SecureRandom
ivLength int
Результат byte[]
Пример #1
0
        public static Asn1Encodable GenerateParameters(string algorithm, SecureRandom random)
        {
            if (algorithm == null)
            {
                throw new ArgumentNullException("algorithm");
            }
            string canonicalAlgorithmName = ParameterUtilities.GetCanonicalAlgorithmName(algorithm);

            if (canonicalAlgorithmName == null)
            {
                throw new SecurityUtilityException("Algorithm " + algorithm + " not recognised.");
            }
            int num = ParameterUtilities.FindBasicIVSize(canonicalAlgorithmName);

            if (num != -1)
            {
                return(ParameterUtilities.CreateIVOctetString(random, num));
            }
            if (canonicalAlgorithmName == "CAST5")
            {
                return(new Cast5CbcParameters(ParameterUtilities.CreateIV(random, 8), 128));
            }
            if (canonicalAlgorithmName == "IDEA")
            {
                return(new IdeaCbcPar(ParameterUtilities.CreateIV(random, 8)));
            }
            if (canonicalAlgorithmName == "RC2")
            {
                return(new RC2CbcParameter(ParameterUtilities.CreateIV(random, 8)));
            }
            throw new SecurityUtilityException("Algorithm " + algorithm + " not recognised.");
        }
Пример #2
0
 private static Asn1OctetString CreateIVOctetString(SecureRandom random, int ivLength)
 {
     return(new DerOctetString(ParameterUtilities.CreateIV(random, ivLength)));
 }