Пример #1
0
        public CryptoService(ICryptoSettings settings)
        {
            _hashAlgorithm = SHA256.Create();

            if (settings.EncryptionKey == null || settings.EncryptionKey.Length != 64)
                throw new ConfigurationErrorsException("CryptoService.EncryptionKey is missing in the configuration table or corrupt! It should be a 64 char length hex representation of a 32 byte array (256 bit), try redeploying the sharvrir or reimporting the schema. Key was: " + (string.IsNullOrEmpty(settings.EncryptionKey) ? "null/empty" : settings.EncryptionKey));

            EncryptionKey = settings.EncryptionKey.FromHexString();
        }
Пример #2
0
        public CryptoService(ICryptoSettings settings)
        {
            _hashAlgorithm = SHA256.Create();

            if (settings.EncryptionKey == null || settings.EncryptionKey.Length != 64)
            {
                throw new ConfigurationErrorsException("CryptoService.EncryptionKey is missing in the configuration table or corrupt! It should be a 64 char length hex representation of a 32 byte array (256 bit), try redeploying the sharvrir or reimporting the schema. Key was: " + (string.IsNullOrEmpty(settings.EncryptionKey) ? "null/empty" : settings.EncryptionKey));
            }

            EncryptionKey = settings.EncryptionKey.FromHexString();
        }
Пример #3
0
 public CryptographyService(ICryptoSettings settings)
 {
     this.settings = settings;
 }
Пример #4
0
 public Crypto(ICryptoSettings settings)
 {
     _salt         = Encoding.ASCII.GetBytes(settings.Salt);
     _sharedSecret = settings.Secret;
 }
Пример #5
0
 public StringEncryptor(IAlgorithmFactory algorithmFactory, ICryptoSettings settings)
 {
     this.settings         = settings;
     this.algorithmFactory = algorithmFactory;
 }