Portable Class Library (PCL) Contrib - Cryptography

前端 未结 3 1628
傲寒
傲寒 2021-02-10 03:14

I want to use the cryptography in the Portable Class Library Contrib project on codeplex but have not found any documentation on how I can use it.

I want to create a wra

3条回答
  •  长发绾君心
    2021-02-10 03:47

    It turns out that my generic wrapper for the cryptography algorithms was causing a problem. PCL Contrib contains a class called SymmetricAlgorithm which is itself a wrapper for the real SymmetricAlgorithm. If I make my wrapper class non-generic it works like this:

    public sealed class AesManagedSymmetricCryptography : SymmetricCryptography
    {
        #region Constructors
    
        public AesManagedSymmetricCryptography()
        {
        }
    
        public AesManagedSymmetricCryptography(byte[] key, byte[] iv)
            : base(key, iv)
        {
        }
    
        public AesManagedSymmetricCryptography(string password, string salt)
            : base(password, salt)
        {
        }
    
        public AesManagedSymmetricCryptography(string password, string salt, int iterations)
            : base(password, salt, iterations)
        {
        }
    
        #endregion
    }
    

提交回复
热议问题