コード例 #1
0
        /****************************************************************************/
        /// <summary>
        /// Retrieves a the encryptor specified by the given id
        /// </summary>
        /// <param name="keyId"></param>
        /// <returns></returns>
        public async Task <IEncryptor> GetValidForDecryption(Guid keyId)
        {
            // See if there's one in the cache
            return(await _cache.Get <IEncryptor>("Decrypt/" + keyId.ToId(), async() =>
            {
                // Create a new encryptor with an existing policy and key
                var key = await _keyFactory.GetDecryptionKey(keyId);

                return _encryptorFactory.Create(key);
            },
                                                 tsExpires : new TimeSpan(0, 30, 0) // Expire after 30 minutes
                                                 ));
        }
コード例 #2
0
 public static IEncryptor CreateEncryptor()
 {
     return((_factory != null) ? _factory.Create() : null);
 }