private void TestFullBuilderPath()
        {
            BasicExpiringCryptoPolicy.IKeyExpirationDaysStep builder = BasicExpiringCryptoPolicy.NewBuilder();

            BasicExpiringCryptoPolicy basicExpiringCryptoPolicy = builder
                                                                  .WithKeyExpirationDays(TestExpirationDays)
                                                                  .WithRevokeCheckMinutes(TestCachingPeriod)
                                                                  .WithRotationStrategy(CryptoPolicy.KeyRotationStrategy.Queued)
                                                                  .WithCanCacheSystemKeys(false)
                                                                  .WithCanCacheIntermediateKeys(false)
                                                                  .WithCanCacheSessions(true)
                                                                  .WithSessionCacheMaxSize(42)
                                                                  .WithSessionCacheExpireMillis(33000)
                                                                  .WithNotifyExpiredSystemKeyOnRead(true)
                                                                  .WithNotifyExpiredIntermediateKeyOnRead(true)
                                                                  .Build();

            Assert.NotNull(basicExpiringCryptoPolicy);
            Assert.Equal(CryptoPolicy.KeyRotationStrategy.Queued, basicExpiringCryptoPolicy.GetKeyRotationStrategy());
            Assert.False(basicExpiringCryptoPolicy.CanCacheSystemKeys());
            Assert.False(basicExpiringCryptoPolicy.CanCacheIntermediateKeys());
            Assert.True(basicExpiringCryptoPolicy.CanCacheSessions());
            Assert.Equal(42, basicExpiringCryptoPolicy.GetSessionCacheMaxSize());
            Assert.Equal(33000, basicExpiringCryptoPolicy.GetSessionCacheExpireMillis());
            Assert.True(basicExpiringCryptoPolicy.NotifyExpiredSystemKeyOnRead());
            Assert.True(basicExpiringCryptoPolicy.NotifyExpiredIntermediateKeyOnRead());
        }
Пример #2
0
 private void TestDefaultsDontChange()
 {
     Assert.True(policy.CanCacheSystemKeys());
     Assert.True(policy.CanCacheIntermediateKeys());
     Assert.Equal(CryptoPolicy.KeyRotationStrategy.Inline, policy.GetKeyRotationStrategy());
     Assert.False(policy.NotifyExpiredSystemKeyOnRead());
     Assert.False(policy.NotifyExpiredIntermediateKeyOnRead());
 }