示例#1
0
        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;
            }
        }
示例#2
0
        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()));
        }
示例#3
0
        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()));
        }