public KeyService(
     KeyRackOptions options,
     IKeyRepository repository,
     IKeySerializer serializer,
     ITimeKeeper timeKeeper,
     ILogger <KeyService> logger)
 {
     _options    = options;
     _repository = repository;
     _serializer = serializer;
     _timeKeeper = timeKeeper;
     _logger     = logger;
 }
        public static RsaSecurityKey CreateSecurityKey(this KeyRackOptions options)
        {
            var            rsa         = RSA.Create();
            RsaSecurityKey securityKey = null;

            if (rsa is RSACryptoServiceProvider)
            {
                // Windows OS - use RSACng instead of RSACryptoServiceProvider
                rsa.Dispose();
                securityKey = new RsaSecurityKey(new RSACng(options.KeySize).ExportParameters(includePrivateParameters: true));
            }
            else
            {
                rsa.KeySize = options.KeySize;
                securityKey = new RsaSecurityKey(rsa);
            }

            securityKey.KeyId = CryptoRandom.CreateUniqueId(options.KeyIdSize / 8, CryptoRandom.OutputFormat.Hex);
            return(securityKey);
        }
 public TimeKeeper(KeyRackOptions options)
 {
     _options = options;
 }
 public KeyStore(IKeyService keyService, KeyRackOptions options)
 {
     _keyService = keyService;
     _options    = options;
 }