Beispiel #1
0
        /// <summary>
        /// Creates a new instance of an <see cref="KeyVaultPlugin"/>.
        /// </summary>
        /// <param name="encryptionSecretName">The name of the secret used to encrypt / decrypt messages.</param>
        /// <param name="options">The <see cref="KeyVaultPluginSettings"/> used to create a new instance.</param>
        public KeyVaultPlugin(string encryptionSecretName, KeyVaultPluginSettings options)
        {
            if (string.IsNullOrEmpty(encryptionSecretName))
            {
                throw new ArgumentNullException(nameof(encryptionSecretName));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            this.secretName                 = encryptionSecretName;
            this.keyVaultEndpoint           = options.Endpoint;
            this.secretManager              = new KeyVaultSecretManager(options.Endpoint, options.ClientId, options.ClientSecret);
            this.initializationVector       = KeyVaultPlugin.GenerateInitializationVector();
            this.base64InitializationVector = Convert.ToBase64String(this.initializationVector);
        }
Beispiel #2
0
 /// <summary>
 /// Creates a new instance of an <see cref="KeyVaultPlugin"/>.
 /// </summary>
 /// <param name="encryptionSecretName">The name of the secret used to encrypt / decrypt messages.</param>
 /// <param name="keyVaultSettings">The <see cref="KeyVaultPluginSettings"/> used to create a new instance.</param>
 public KeyVaultPlugin(string encryptionSecretName, KeyVaultPluginSettings keyVaultSettings)
     : this(encryptionSecretName, string.Empty, keyVaultSettings)
 {
 }