SetKey() публичный абстрактный Метод

public abstract SetKey ( AsymmetricAlgorithm key ) : void
key AsymmetricAlgorithm
Результат void
        public virtual AsymmetricSignatureFormatter CreateFormatter(AsymmetricAlgorithm key)
        {
            AsymmetricSignatureFormatter formatter = (AsymmetricSignatureFormatter)CryptoConfig.CreateFromName(this._strFormatter);

            formatter.SetKey(key);
            return(formatter);
        }
Пример #2
0
        /// <summary>Creates an <see cref="T:System.Security.Cryptography.AsymmetricSignatureFormatter" /> instance with the specified key using the <see cref="P:System.Security.Cryptography.SignatureDescription.FormatterAlgorithm" /> property.</summary>
        /// <returns>The newly created <see cref="T:System.Security.Cryptography.AsymmetricSignatureFormatter" /> instance.</returns>
        /// <param name="key">The key to use in the <see cref="T:System.Security.Cryptography.AsymmetricSignatureFormatter" />. </param>
        public virtual AsymmetricSignatureFormatter CreateFormatter(AsymmetricAlgorithm key)
        {
            if (this._FormatterAlgorithm == null)
            {
                throw new ArgumentNullException("FormatterAlgorithm");
            }
            AsymmetricSignatureFormatter asymmetricSignatureFormatter = (AsymmetricSignatureFormatter)CryptoConfig.CreateFromName(this._FormatterAlgorithm);

            if (this._KeyAlgorithm == null)
            {
                throw new NullReferenceException("KeyAlgorithm");
            }
            asymmetricSignatureFormatter.SetKey(key);
            return(asymmetricSignatureFormatter);
        }
Пример #3
0
        public virtual AsymmetricSignatureFormatter CreateFormatter(AsymmetricAlgorithm key)
        {
            if (_FormatterAlgorithm == null)
            {
                throw new ArgumentNullException("FormatterAlgorithm");
            }

            // this should throw the InvalidCastException if we have an invalid class
            // (but not if the class doesn't exist - as null is valid for AsymmetricSignatureDeformatter)
            AsymmetricSignatureFormatter fmt = (AsymmetricSignatureFormatter)CryptoConfig.CreateFromName(_FormatterAlgorithm);

            if (_KeyAlgorithm == null)
            {
                throw new NullReferenceException("KeyAlgorithm");
            }

            fmt.SetKey(key);
            return(fmt);
        }