public X509Certificate2 GetCertificate(string thumbprint) { if (thumbprint == null) { return(null); } else { return(GeneralUtilities.GetCertificateFromStore(thumbprint)); } }
private void AddCertificates(ServiceCertificateListResponse uploadedCertificates, PublishContext context) { string name = context.ServiceName; CloudServiceProject cloudServiceProject = context.ServiceProject; if (cloudServiceProject.Components.CloudConfig.Role != null) { foreach (ConfigCertificate certElement in cloudServiceProject.Components.CloudConfig.Role. SelectMany(r => r.Certificates ?? new ConfigCertificate[0]).Distinct()) { if (uploadedCertificates == null || (uploadedCertificates.Certificates.Count(c => c.Thumbprint.Equals( certElement.thumbprint, StringComparison.OrdinalIgnoreCase)) < 1)) { X509Certificate2 cert = GeneralUtilities.GetCertificateFromStore(certElement.thumbprint); UploadCertificate(cert, certElement, name); } } } }
public AzureProfile Deserialize(string contents) { ProfileData data = null; AzureProfile profile = new AzureProfile(new VirtualDiskDataStore()); try { DataContractSerializer serializer = new DataContractSerializer(typeof(ProfileData)); using (MemoryStream s = new MemoryStream(Encoding.UTF8.GetBytes(contents ?? ""))) { data = (ProfileData)serializer.ReadObject(s); } } catch (XmlException) { } if (data != null) { foreach (AzureEnvironmentData oldEnv in data.Environments) { profile.AddEnvironment(oldEnv.ToAzureEnvironment()); } List <AzureEnvironment> envs = profile.Environments; foreach (AzureSubscriptionData oldSubscription in data.Subscriptions) { profile.AddSubscription(oldSubscription.ToAzureSubscription(envs)); if (!string.IsNullOrEmpty(oldSubscription.ManagementCertificate)) { profile.AddCertificate(GeneralUtilities.GetCertificateFromStore(oldSubscription.ManagementCertificate)); } } } return(profile); }
public X509Certificate2 GetCertificate(string thumbprint) { return(GeneralUtilities.GetCertificateFromStore(thumbprint)); }