예제 #1
0
        private void Init()
        {
            _hashSHA1Generator        = AlgorithmFactory.GetHasher(EHashType.SHA_1);
            _hashSHA256Generator      = AlgorithmFactory.GetHasher(EHashType.SHA_256);
            hashSHA512Generator       = AlgorithmFactory.GetHasher(EHashType.SHA_512);
            defaultHashGenerator      = hashSHA512Generator;
            signHMACSHA1Generator     = AlgorithmFactory.GetSigner(ESignType.HMAC_SHA1);
            signHMACSHA256Generator   = AlgorithmFactory.GetSigner(ESignType.HMAC_SHA256);
            _saltGenerator            = new SecureRNGAdapter();
            _asymmetricCryptGenerator = new RSAAdapter();

            Encoder = Encoding.UTF8;
            aes128  = AlgorithmFactory.GetSymmetricTransformCrypt(ESymmetricTransformCryptType.AES_128);
            aes256  = AlgorithmFactory.GetSymmetricTransformCrypt(ESymmetricTransformCryptType.AES_256);
        }
예제 #2
0
 private static int GetCryptInitializationVectorSizeInBytes(ISymmetricTransformCrypt transformCrypt)
 {
     return(transformCrypt.InitializationVectorSizeInBytes);
 }
예제 #3
0
 private static CryptoStream GetDecryptorStream(ISymmetricTransformCrypt transformCrypt, Stream outputStream, byte[] key, byte[] iv)
 {
     return(transformCrypt.GetDecryptorStream(outputStream, new CryptAlgorithmParameters(key, iv)));
 }