internal override void ReadProperty(JsonProperty prop) { switch (prop.Name) { case IdPropertyName: Key.Id = prop.Value.GetString(); Properties.Id = new Uri(Key.Id); KeyVaultIdentifier kvid = KeyVaultIdentifier.Parse(Properties.Id); Properties.Name = kvid.Name; Properties.VaultUri = kvid.VaultUri; Properties.Version = kvid.Version; break; case ContentTypePropertyName: ContentType = prop.Value.GetString(); break; case ValuePropertyName: byte[] keyBytes = Base64Url.Decode(prop.Value.GetString()); Key.K = keyBytes; break; default: base.ReadProperty(prop); break; } }
private async Task <Key> GetKeyAsync(Uri keyId, CancellationToken cancellationToken) { using Request request = CreateGetRequest(keyId); Response response = await _pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false); return(KeyVaultIdentifier.Parse(keyId).Collection == KeyVaultIdentifier.SecretsCollection ? (Key)ParseResponse(response, new SecretKey()) : ParseResponse(response, new Key())); }
private Key GetKey(Uri keyId, CancellationToken cancellationToken) { using Request request = CreateGetRequest(keyId); Response response = _pipeline.SendRequest(request, cancellationToken); return(KeyVaultIdentifier.Parse(keyId).Collection == KeyVaultIdentifier.SecretsCollection ? (Key)ParseResponse(response, new SecretKey()) : ParseResponse(response, new Key())); }