예제 #1
0
        ///GENMHASH:507A92D4DCD93CE9595A78198DEBDFCF:5983BB56B6190FDBBCF28E6CF2A5422F
        public async Task <Microsoft.Azure.Management.KeyVault.Fluent.IKey> UpdateResourceAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            IKey key = this;

            if (createKeyRequest != null || importKeyRequest != null)
            {
                key = await CreateRawAsync(cancellationToken);
            }
            if (updateKeyRequest != null)
            {
                await vault.Client.UpdateKeyAsync(
                    Inner.KeyIdentifier.Identifier,
                    updateKeyRequest.KeyOperations.Select(ops => ops.Value).ToArray(),
                    updateKeyRequest.KeyAttributes,
                    updateKeyRequest.Tags,
                    cancellationToken);
            }
            await RefreshAsync(cancellationToken);

            createKeyRequest = null;
            importKeyRequest = null;
            updateKeyRequest = new UpdateKeyRequest
            {
                VaultBaseUrl = vault.VaultUri,
                KeyName      = Name
            };
            return(this);
        }
예제 #2
0
 ///GENMHASH:3D1F4F9B31A1E4FAB317EE4E0C5C9528:5CADE1B284DC5DE1B854039B12712163
 public KeyImpl WithLocalKeyToImport(Microsoft.Azure.KeyVault.WebKey.JsonWebKey key)
 {
     importKeyRequest = new ImportKeyRequest
     {
         VaultBaseUrl = vault.VaultUri,
         KeyName      = Name,
         Key          = key
     };
     return(this);
 }
예제 #3
0
        private async Task <Microsoft.Azure.Management.KeyVault.Fluent.IKey> CreateRawAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            if (createKeyRequest != null)
            {
                SetInner(await vault.Client.CreateKeyAsync(
                             createKeyRequest.VaultBaseUrl,
                             createKeyRequest.KeyName,
                             createKeyRequest.KeyType.Value,
                             createKeyRequest.KeySize,
                             createKeyRequest.KeyOperations.Select(ops => ops.Value).ToList(),
                             createKeyRequest.KeyAttributes,
                             createKeyRequest.Tags,
                             curve: null,
                             cancellationToken: cancellationToken));

                createKeyRequest = null;
                updateKeyRequest = new UpdateKeyRequest
                {
                    VaultBaseUrl = vault.VaultUri,
                    KeyName      = Name
                };
            }
            else
            {
                SetInner(await vault.Client.ImportKeyAsync(
                             importKeyRequest.VaultBaseUrl,
                             importKeyRequest.KeyName,
                             importKeyRequest.Key,
                             importKeyRequest.IsHsm,
                             importKeyRequest.KeyAttributes,
                             importKeyRequest.Tags,
                             cancellationToken));
                importKeyRequest = null;
                updateKeyRequest = new UpdateKeyRequest
                {
                    VaultBaseUrl = vault.VaultUri,
                    KeyName      = Name
                };
            }
            return(this);
        }