private static CreateIV ( |
||
random | ||
ivLength | int | |
Résultat | byte[] |
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."); }
private static Asn1OctetString CreateIVOctetString(SecureRandom random, int ivLength) { return(new DerOctetString(ParameterUtilities.CreateIV(random, ivLength))); }