Exemple #1
0
        /// <summary>
        /// Takes a string and creates a signed hash of it
        /// </summary>
        /// <param name="Input">Input string</param>
        /// <param name="Key">Key to encrypt/sign with</param>
        /// <param name="Hash">This will be filled with the unsigned hash</param>
        /// <param name="EncodingUsing">Encoding that the input is using (defaults to UTF8)</param>
        /// <returns>A signed hash of the input (64bit string)</returns>
        public string SignHash(string Input, string Key, out string Hash, Encoding EncodingUsing = null)
        {
            Contract.Requires <NullReferenceException>(AsymmetricAlgorithms != null, "AsymmetricAlgorithms");
            IAsymmetric Found = AsymmetricAlgorithms.FirstOrDefault();

            if (Found == null)
            {
                throw new ArgumentException("No asymmetric encryption algorithm found");
            }
            return(Found.SignHash(Input, Key, out Hash, EncodingUsing));
        }