Example #1
0
        /// <summary>
        /// Creates a certificate import used to import a certificate into Azure Key Vault
        /// </summary>
        /// <param name="name">A name for the imported certificate</param>
        /// <param name="value">The PFX or PEM formatted value of the certificate containing both the x509 certificates and the private key</param>
        /// <param name="policy">The policy which governs the lifecycle of the imported certificate and it's properties when it is rotated</param>
        public CertificateImport(string name, byte[] value, CertificatePolicy policy)
        {
            Argument.AssertNotNullOrEmpty(name, nameof(name));
            Argument.AssertNotNull(value, nameof(value));
            Argument.AssertNotNull(policy, nameof(policy));

            Name   = name;
            Value  = value ?? throw new ArgumentNullException(nameof(value));
            Policy = policy ?? throw new ArgumentNullException(nameof(policy));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ImportCertificateOptions"/> class.
        /// </summary>
        /// <param name="name">A name for the imported certificate.</param>
        /// <param name="value">The PFX or PEM formatted value of the certificate containing both the X.509 certificates and the private key.</param>
        /// <param name="policy">The policy which governs the lifecycle of the imported certificate and its properties when it is rotated.</param>
        /// <exception cref="ArgumentException"><paramref name="name"/> is empty.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="name"/>, <paramref name="policy"/>, or <paramref name="value"/> is null.</exception>
        public ImportCertificateOptions(string name, byte[] value, CertificatePolicy policy)
        {
            Argument.AssertNotNullOrEmpty(name, nameof(name));
            Argument.AssertNotNull(value, nameof(value));
            Argument.AssertNotNull(policy, nameof(policy));

            Name   = name;
            Value  = value;
            Policy = policy;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="Certificates.KeyVaultCertificateWithPolicy"/> for mocking purposes.
 /// </summary>
 /// <param name="properties">Sets the <see cref="Certificates.KeyVaultCertificate.Properties"/> property.</param>
 /// <param name="keyId">Sets the <see cref="Certificates.KeyVaultCertificate.KeyId"/> property.</param>
 /// <param name="secretId">Sets the <see cref="Certificates.KeyVaultCertificate.SecretId"/> property.</param>
 /// <param name="cer">Sets the <see cref="Certificates.KeyVaultCertificate.Cer"/> property.</param>
 /// <param name="policy">Sets the <see cref="Certificates.KeyVaultCertificateWithPolicy.Policy"/> property.</param>
 /// <returns>A new instance of the <see cref="Certificates.KeyVaultCertificateWithPolicy"/> for mocking purposes.</returns>
 public static KeyVaultCertificateWithPolicy KeyVaultCertificateWithPolicy(
     CertificateProperties properties,
     Uri keyId                = default,
     Uri secretId             = default,
     byte[] cer               = default,
     CertificatePolicy policy = default) => new KeyVaultCertificateWithPolicy(properties)
 {
     KeyId    = keyId,
     SecretId = secretId,
     Cer      = cer,
     Policy   = policy,
 };
Example #4
0
        internal override void ReadProperty(JsonProperty prop)
        {
            switch (prop.Name)
            {
            case PolicyPropertyName:
                Policy = new CertificatePolicy();
                ((IJsonDeserializable)Policy).ReadProperties(prop.Value);
                break;

            default:
                base.ReadProperty(prop);
                break;
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="Certificates.DeletedCertificate"/> for mocking purposes.
 /// </summary>
 /// <param name="properties">Sets the <see cref="Certificates.KeyVaultCertificate.Properties"/> property.</param>
 /// <param name="keyId">Sets the <see cref="Certificates.KeyVaultCertificate.KeyId"/> property.</param>
 /// <param name="secretId">Sets the <see cref="Certificates.KeyVaultCertificate.SecretId"/> property.</param>
 /// <param name="cer">Sets the <see cref="Certificates.KeyVaultCertificate.Cer"/> property.</param>
 /// <param name="policy">Sets the <see cref="Certificates.KeyVaultCertificateWithPolicy.Policy"/> property.</param>
 /// <param name="recoveryId">Sets the <see cref="Certificates.DeletedCertificate.RecoveryId"/> property.</param>
 /// <param name="deletedOn">Sets the <see cref="Certificates.DeletedCertificate.DeletedOn"/> property.</param>
 /// <param name="scheduledPurgeDate">Sets the <see cref="Certificates.DeletedCertificate.ScheduledPurgeDate"/> property.</param>
 /// <returns>A new instance of the <see cref="Certificates.DeletedCertificate"/> for mocking purposes.</returns>
 public static DeletedCertificate DeletedCertificate(
     CertificateProperties properties,
     Uri keyId                         = default,
     Uri secretId                      = default,
     byte[] cer                        = default,
     CertificatePolicy policy          = default,
     Uri recoveryId                    = default,
     DateTimeOffset?deletedOn          = default,
     DateTimeOffset?scheduledPurgeDate = default) => new DeletedCertificate(properties)
 {
     KeyId              = keyId,
     SecretId           = secretId,
     Cer                = cer,
     Policy             = policy,
     RecoveryId         = recoveryId,
     DeletedOn          = deletedOn,
     ScheduledPurgeDate = scheduledPurgeDate,
 };
Example #6
0
        /// <summary>
        /// Creates a certificate import used to import a certificate into Azure Key Vault
        /// </summary>
        /// <param name="name">A name for the imported certificate</param>
        /// <param name="value">The PFX or PEM formatted value of the certificate containing both the x509 certificates and the private key</param>
        /// <param name="policy">The policy which governs the lifecycle of the imported certificate and it's properties when it is rotated</param>
        public CertificateImport(string name, byte[] value, CertificatePolicy policy)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException($"{nameof(name)} must not be null or empty");
            }
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }
            if (policy == null)
            {
                throw new ArgumentNullException(nameof(policy));
            }

            Name   = name;
            Value  = value;
            Policy = policy;
        }
 public CertificateCreateParameters(CertificatePolicy policy, bool?enabled, IDictionary <string, string> tags)
 {
     Policy  = policy;
     Enabled = enabled;
     Tags    = tags;
 }
 public virtual Task <Response <CertificateBase> > UpdateCertificatePolicyAsync(string certificateName, CertificatePolicy policy, CertificateBase certificateBase, CancellationToken cancellationToken = default)
 {
     throw new NotImplementedException();
 }