Beispiel #1
0
 public Certificate Add(Certificate cert)
 {
     using (ConfigDatabase db = this.Store.CreateContext())
     {
         this.Add(db, cert);
         db.SubmitChanges();
         return cert;
     }                        
 }
 public Certificate AddCertificate(Certificate certificate)
 {
     try
     {
         return Store.Certificates.Add(certificate);
     }
     catch (Exception ex)
     {
         throw CreateFault("AddCertificates", ex);
     }
 }
Beispiel #3
0
 public void Add(ConfigDatabase db, Certificate cert)
 {
     if (db == null)
     {
         throw new ArgumentNullException("db");
     }
     
     if (cert == null)
     {
         throw new ConfigStoreException(ConfigStoreError.InvalidCertificate);
     }
     
     cert.ValidateHasData();
     db.Certificates.InsertOnSubmit(cert);
 }
 public void AddCertificates(Certificate[] certificates)
 {
     if (certificates == null)
     {
         return;
     }
     
     try
     {
         Store.Certificates.Add(certificates);
     }
     catch (Exception ex)
     {
         throw CreateFault("AddCertificates", ex);
     }
 }
Beispiel #5
0
        internal Certificate ApplyTo(Certificate cert)
        {
            if (cert == null)
            {
                return cert;
            }
            
            if (this.Status != null && Status.Value != cert.Status)
            {
                return null;
            }
            
            if (!this.IncludeData)
            {
                cert.ClearData();
            }
            else if (!this.IncludePrivateKey)
            {
                cert.ExcludePrivateKey();
            }

            return cert;
        }
 Certificate ApplyGetOptions(Certificate cert, CertificateGetOptions options)
 {
     if (options == null)
     {
         options = CertificateGetOptions.Default;
     }
     
     return options.ApplyTo(cert);
 }
 Certificate[] ApplyGetOptions(Certificate[] certs, CertificateGetOptions options)
 {
     if (certs == null)
     {
         return null;
     }
     
     return (from cert in (from cert in certs
                           where cert != null
                           select ApplyGetOptions(cert, options)
                          )
             where cert != null
             select cert).ToArray();
 }
Beispiel #8
0
 public Certificate ChangeStatus(Certificate certificate, EntityStatus status)
 {
     Client.SetCertificateStatus(new[] { certificate.ID}, status);
     certificate.Status = status;
     return certificate;
 }
Beispiel #9
0
 public Certificate Update(Certificate certificate)
 {
     throw new NotSupportedException("Updates are not supported on Certificates");
 }
Beispiel #10
0
 public void Delete(Certificate certificate)
 {
     Client.RemoveCertificates(new[] {certificate.ID});
 }
Beispiel #11
0
 public Certificate Add(Certificate certificate)
 {
     return Client.AddCertificate(certificate);
 }
Beispiel #12
0
 public static X509Certificate2Collection ToX509Collection(Certificate[] source)
 {
     if (source.IsNullOrEmpty())
     {
         return null;
     }
     
     X509Certificate2Collection x509Coll = new X509Certificate2Collection();
     if (source != null)
     {
         for (int i = 0; i < source.Length; ++i)
         {
             x509Coll.Add(source[i].ToX509Certificate());
         }
     }
     return x509Coll;
 }