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

            if (gost == null)
            {
                throw new ArgumentNullException(nameof(gost));
            }
            _gostKey = gost;
        }
Beispiel #3
0
        public static Gost3410 Create(Gost3410Parameters parameters)
        {
            Gost3410 gost = Create();

            try
            {
                gost.ImportParameters(parameters);
                return(gost);
            }
            catch
            {
                gost.Dispose();
                throw;
            }
        }
Beispiel #4
0
        public static Gost3410 Create(int keySizeInBits)
        {
            Gost3410 gost = Create();

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