public IStreamCalculator CreateCalculator() { ISigner signer; if (algID.Algorithm.Equals(RosstandartObjectIdentifiers.id_tc26_signwithdigest_gost_3410_12_256)) { signer = new Gost3410DigestSigner(new ECGost3410Signer(), new Gost3411_2012_256Digest()); } else if (algID.Algorithm.Equals(RosstandartObjectIdentifiers.id_tc26_signwithdigest_gost_3410_12_512)) { signer = new Gost3410DigestSigner(new ECGost3410Signer(), new Gost3411_2012_512Digest()); } else if (algID.Algorithm.Equals(CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x2001)) { signer = new Gost3410DigestSigner(new ECGost3410Signer(), new Gost3411Digest()); } else if (algID.Algorithm.Equals(CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x94)) { signer = new Gost3410DigestSigner(new Gost3410Signer(), new Gost3411Digest()); } else { throw new SecurityUtilityException("Signer " + algorithm + " not recognised."); } signer.Init(true, ParameterUtilities.WithRandom(privateKey, random)); return(new DefaultSignatureCalculator(signer)); }