Example #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();
        }
Example #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();
        }
Example #3
0
 public CryptographyService(ICryptoSettings settings)
 {
     this.settings = settings;
 }
Example #4
0
 public Crypto(ICryptoSettings settings)
 {
     _salt         = Encoding.ASCII.GetBytes(settings.Salt);
     _sharedSecret = settings.Secret;
 }
Example #5
0
 public StringEncryptor(IAlgorithmFactory algorithmFactory, ICryptoSettings settings)
 {
     this.settings         = settings;
     this.algorithmFactory = algorithmFactory;
 }