Example #1
0
        /// <summary>
        /// Encrypts the aes.
        /// </summary>
        /// <param name="provider">The provider.</param>
        /// <param name="orignal">The orignal.</param>
        /// <returns></returns>
        public static byte[] EncryptAes(this RijndaelProvider provider, byte[] orignal)
        {
            try
            {
                provider.CheckNullObject(nameof(provider));
                orignal.CheckNullOrEmptyCollection(nameof(orignal));

                return(provider.EncryptAes(orignal));
            }
            catch (Exception ex)
            {
                throw ex.Handle(new { orignal });
            }
        }
Example #2
0
        /// <summary>
        /// Decrypts the aes.
        /// </summary>
        /// <param name="provider">The provider.</param>
        /// <param name="bytesToDecrypt">The bytes to decrypt.</param>
        /// <returns></returns>
        public static byte[] DecryptAes(this RijndaelProvider provider, byte[] bytesToDecrypt)
        {
            try
            {
                provider.CheckNullObject(nameof(provider));
                bytesToDecrypt.CheckNullOrEmptyCollection(nameof(bytesToDecrypt));

                return(provider.DecryptAes(bytesToDecrypt));
            }
            catch (Exception ex)
            {
                throw ex.Handle(new { bytesToDecrypt });
            }
        }
Example #3
0
 /// <summary>
 /// Creates the aes provider.
 /// </summary>
 /// <param name="aesKeys">The aes keys.</param>
 /// <returns></returns>
 public static RijndaelProvider CreateAesProvider(this IAesKeys aesKeys)
 {
     return(RijndaelProvider.CreateProvider(aesKeys));
 }