示例#1
0
 public Certificate Add(Certificate cert)
 {
     using (ConfigDatabase db = this.Store.CreateContext())
     {
         this.Add(db, cert);
         db.SubmitChanges();
         return cert;
     }                        
 }
示例#2
0
 public Certificate AddCertificate(Certificate certificate)
 {
     try
     {
         return Store.Certificates.Add(certificate);
     }
     catch (Exception ex)
     {
         throw CreateFault("AddCertificates", ex);
     }
 }
示例#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);
 }
示例#4
0
 public void AddCertificates(Certificate[] certificates)
 {
     if (certificates == null)
     {
         return;
     }
     
     try
     {
         Store.Certificates.Add(certificates);
     }
     catch (Exception ex)
     {
         throw CreateFault("AddCertificates", ex);
     }
 }
示例#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;
        }
示例#6
0
 Certificate ApplyGetOptions(Certificate cert, CertificateGetOptions options)
 {
     if (options == null)
     {
         options = CertificateGetOptions.Default;
     }
     
     return options.ApplyTo(cert);
 }
示例#7
0
 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();
 }
示例#8
0
 public Certificate ChangeStatus(Certificate certificate, EntityStatus status)
 {
     Client.SetCertificateStatus(new[] { certificate.ID}, status);
     certificate.Status = status;
     return certificate;
 }
示例#9
0
 public Certificate Update(Certificate certificate)
 {
     throw new NotSupportedException("Updates are not supported on Certificates");
 }
示例#10
0
 public void Delete(Certificate certificate)
 {
     Client.RemoveCertificates(new[] {certificate.ID});
 }
示例#11
0
 public Certificate Add(Certificate certificate)
 {
     return Client.AddCertificate(certificate);
 }
示例#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;
 }