internal void SetObjectIdentifier(VaultUriHelper vaultUriHelper, Client.ObjectIdentifier identifier)
        {
            if (vaultUriHelper == null)
            {
                throw new ArgumentNullException("vaultUriHelper");
            }

            VaultName = vaultUriHelper.GetVaultName(identifier.Identifier);
            Name = identifier.Name;
            Version = identifier.Version;
        }
        internal SecretIdentityItem(Client.SecretItem clientSecretItem, VaultUriHelper vaultUriHelper)
        {
            if (clientSecretItem == null)
            {
                throw new ArgumentNullException("clientSecretItem");
            }

            if (String.IsNullOrEmpty(clientSecretItem.Id))
            {
                throw new ArgumentException(Resources.InvalidSecretUri);
            }

            SetObjectIdentifier(vaultUriHelper, new Client.SecretIdentifier(clientSecretItem.Id));
            Id = clientSecretItem.Id;
        }
Exemplo n.º 3
0
        internal KeyIdentityItem(Client.KeyItem clientKeyItem, VaultUriHelper vaultUriHelper)
        {
            if (clientKeyItem == null)
            {
                throw new ArgumentNullException("clientKeyItem");
            }
            if (String.IsNullOrEmpty(clientKeyItem.Kid) || clientKeyItem.Attributes == null)
            {
                throw new ArgumentException(Resources.InvalidKeyBundle);
            }

            SetObjectIdentifier(vaultUriHelper, new Client.KeyIdentifier(clientKeyItem.Kid));

            var attribute = new KeyAttributes(
                clientKeyItem.Attributes.Enabled,
                clientKeyItem.Attributes.Expires,
                clientKeyItem.Attributes.NotBefore);

            Enabled = attribute.Enabled;
            Expires = attribute.Expires;
            NotBefore = attribute.NotBefore;
            Id = clientKeyItem.Kid;
        }
Exemplo n.º 4
0
        internal KeyBundle(Client.KeyBundle clientKeyBundle, VaultUriHelper vaultUriHelper)
        {
            if (clientKeyBundle == null)
            {
                throw new ArgumentNullException("clientKeyBundle");
            }            
            if (clientKeyBundle.Key == null || clientKeyBundle.Attributes == null)
            {
                throw new ArgumentException(Resources.InvalidKeyBundle);
            }

            SetObjectIdentifier(vaultUriHelper, new Client.KeyIdentifier(clientKeyBundle.Key.Kid));

            Key = clientKeyBundle.Key;
            Attributes = new KeyAttributes(
                clientKeyBundle.Attributes.Enabled,
                clientKeyBundle.Attributes.Expires, 
                clientKeyBundle.Attributes.NotBefore, 
                clientKeyBundle.Key.Kty, 
                clientKeyBundle.Key.KeyOps);

            Id = clientKeyBundle.Key.Kid;
        }