コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CryptographyClient"/> class.
        /// </summary>
        /// <param name="keyId">The <see cref="KeyBase.Id"/> of the <see cref="Key"/> which will be used for cryptographic operations.</param>
        /// <param name="credential">A <see cref="TokenCredential"/> capable of providing an OAuth token.</param>
        /// <param name="options">Options to configure the management of the request sent to Key Vault.</param>
        /// <exception cref="ArgumentNullException"><paramref name="keyId"/> or <paramref name="credential"/> is null.</exception>
        /// <exception cref="NotSupportedException">The <see cref="CryptographyClientOptions.Version"/> is not supported.</exception>
        public CryptographyClient(Uri keyId, TokenCredential credential, CryptographyClientOptions options)
        {
            Argument.AssertNotNull(keyId, nameof(keyId));
            Argument.AssertNotNull(credential, nameof(credential));

            _keyId = keyId;
            options ??= new CryptographyClientOptions();

            var remoteProvider = new RemoteCryptographyClient(keyId, credential, options);

            _pipeline       = remoteProvider.Pipeline;
            _remoteProvider = remoteProvider;
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the CryptographyClient class.
        /// </summary>
        /// <param name="keyId">The <see cref="KeyBase.Id"/> of the <see cref="Key"/> which will be used for cryptographic operations</param>
        /// <param name="credential">Represents a credential capable of providing an OAuth token.</param>
        /// <param name="options">Options that allow to configure the management of the request sent to Key Vault.</param>
        public CryptographyClient(Uri keyId, TokenCredential credential, CryptographyClientOptions options)
        {
            _keyId = keyId ?? throw new ArgumentNullException(nameof(keyId));
            if (credential is null)
            {
                throw new ArgumentNullException(nameof(credential));
            }

            options ??= new CryptographyClientOptions();

            var remoteProvider = new RemoteCryptographyClient(keyId, credential, options);

            _pipeline       = remoteProvider.Pipeline;
            _cryptoProvider = remoteProvider;
        }