コード例 #1
0
 /// <summary>
 /// Устанавливает ключ, используемый при создании подписи.
 /// </summary>
 ///
 /// <param name="key">Объект, содержащий ключ.</param>
 ///
 /// <argnull name="key" />
 /// <exception cref="CryptographicException">Параметр
 /// <paramref name="key"/> не является реализацией
 /// алгоритма ГОСТ Р 34.10-2012 512.</exception>
 public override void SetKey(AsymmetricAlgorithm key)
 {
     if (key == null)
     {
         throw new ArgumentNullException(nameof(key));
     }
     _gostKey = (Gost3410_2012_512)key;
 }
コード例 #2
0
        /// <summary>
        /// Создание объекта класса <see cref="Gost2012_512SignatureFormatter"/>
        /// с заданным ключом.
        /// </summary>
        ///
        /// <param name="key">Провайдер, содержащий ключ.</param>
        ///
        /// <doc-sample path="Simple\DocBlock" name="SignatureFormatter2012_512"
        /// region="SignatureFormatter2012_512">Пример, вычисления подписи при
        /// помощи GostSignatureFormatter.</doc-sample>
        ///
        /// <argnull name="key" />
        /// <exception cref="CryptographicException">Параметр
        /// <paramref name="key"/> не является реализацией
        /// алгоритма ГОСТ Р 34.10-2012 512.</exception>
        public Gost2012_512SignatureFormatter(AsymmetricAlgorithm key)
            : this()
        {
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }
            Gost3410_2012_512 gost = key as Gost3410_2012_512;

            if (gost == null)
            {
                throw new ArgumentNullException(nameof(gost));
            }
            _gostKey = gost;
        }
コード例 #3
0
        public static Gost3410_2012_512 Create(Gost3410Parameters parameters)
        {
            Gost3410_2012_512 gost = Create();

            try
            {
                gost.ImportParameters(parameters);
                return(gost);
            }
            catch
            {
                gost.Dispose();
                throw;
            }
        }
コード例 #4
0
        public static Gost3410_2012_512 Create(int keySizeInBits)
        {
            Gost3410_2012_512 gost = Create();

            try
            {
                gost.KeySize = keySizeInBits;
                return(gost);
            }
            catch
            {
                gost.Dispose();
                throw;
            }
        }