private bool HasCryptoModeChanged(RMSTrustedPublishingDomain oldDefaultTPD, string newSlcCertChainCompressed) { XrmlCertificateChain xrmlCertificateChain = RMUtil.DecompressSLCCertificate(oldDefaultTPD.SLCCertChain); XrmlCertificateChain xrmlCertificateChain2 = RMUtil.DecompressSLCCertificate(newSlcCertChainCompressed); return(xrmlCertificateChain.GetCryptoMode() != xrmlCertificateChain2.GetCryptoMode()); }
private void GetPrivateKeys(RMSTrustedPublishingDomain oldDefaultTPD, string slcCertChainCompressed) { if (oldDefaultTPD == null || string.IsNullOrEmpty(oldDefaultTPD.PrivateKey) || this.HasCryptoModeChanged(oldDefaultTPD, slcCertChainCompressed)) { this.resealKey = false; this.privateKeys = SharedServerBoxRacIdentityGenerator.EmptyPrivateKeys; return; } this.privateKeys = new Dictionary <string, PrivateKeyInformation>(1, StringComparer.OrdinalIgnoreCase); PrivateKeyInformation privateKeyInformation = new PrivateKeyInformation(oldDefaultTPD.KeyId, oldDefaultTPD.KeyIdType, oldDefaultTPD.KeyContainerName, oldDefaultTPD.KeyNumber, oldDefaultTPD.CSPName, oldDefaultTPD.CSPType, oldDefaultTPD.PrivateKey, false); this.privateKeys.Add(privateKeyInformation.Identity, privateKeyInformation); this.resealKey = true; }
public ImportRmsTrustedPublishingDomainResult(RMSTrustedPublishingDomain rmsTpd) : base(rmsTpd) { this.IntranetLicensingUrl = rmsTpd.IntranetLicensingUrl; this.ExtranetLicensingUrl = rmsTpd.ExtranetLicensingUrl; this.IntranetCertificationUrl = rmsTpd.IntranetCertificationUrl; this.ExtranetCertificationUrl = rmsTpd.ExtranetCertificationUrl; this.Default = rmsTpd.Default; this.CSPType = rmsTpd.CSPType; this.CSPName = rmsTpd.CSPName; this.KeyContainerName = rmsTpd.KeyContainerName; this.KeyId = rmsTpd.KeyId; this.KeyIdType = rmsTpd.KeyIdType; this.KeyNumber = rmsTpd.KeyNumber; base.Name = rmsTpd.Name; }
private IEnumerable <RmsTemplate> AcquireRmsTemplates() { if (this.orgId == OrganizationId.ForestWideOrgId) { return(RmsClientManager.AcquireRmsTemplates(this.orgId, true)); } if (this.irmConfiguration == null || (!this.irmConfiguration.InternalLicensingEnabled && !this.displayTemplatesIfInternalLicensingDisabled)) { return(DrmEmailConstants.EmptyTemplateArray); } RMSTrustedPublishingDomain rmstrustedPublishingDomain = this.FindTPD(); if (rmstrustedPublishingDomain == null) { return(DrmEmailConstants.EmptyTemplateArray); } List <RmsTemplate> list = null; if (!MultiValuedPropertyBase.IsNullOrEmpty(rmstrustedPublishingDomain.RMSTemplates)) { list = new List <RmsTemplate>(rmstrustedPublishingDomain.RMSTemplates.Count + 2); using (MultiValuedProperty <string> .Enumerator enumerator = rmstrustedPublishingDomain.RMSTemplates.GetEnumerator()) { while (enumerator.MoveNext()) { string encodedTemplate = enumerator.Current; RmsTemplateType type = RmsTemplateType.Archived; string templateXrml = RMUtil.DecompressTemplate(encodedTemplate, out type); if (this.ShouldFetch(type)) { list.Add(RmsTemplate.CreateServerTemplateFromTemplateDefinition(templateXrml, type)); } } goto IL_CE; } } list = new List <RmsTemplate>(2); IL_CE: if (this.typeToFetch != RmsTemplateType.Archived && rmstrustedPublishingDomain.Default) { list.Add(RmsTemplate.DoNotForward); if (this.irmConfiguration.InternetConfidentialEnabled) { list.Add(RmsTemplate.InternetConfidential); } } return(list); }
public SharedServerBoxRacIdentityGenerator(string slcCertChainCompressed, RMSTrustedPublishingDomain oldDefaultTPD, string sharedKey) { if (string.IsNullOrEmpty(slcCertChainCompressed)) { throw new ArgumentNullException("slcCertChainCompressed"); } this.compressedCertChain = slcCertChainCompressed; this.GetPrivateKeys(oldDefaultTPD, slcCertChainCompressed); this.originalSharedKey = sharedKey; this.compressedTrustedDomains = new List <string>(2); this.compressedTrustedDomains.Add(this.compressedCertChain); if (oldDefaultTPD != null) { this.compressedTrustedDomains.Add(oldDefaultTPD.SLCCertChain); } }
protected override IConfigDataProvider CreateSession() { IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(base.DomainController, false, ConsistencyMode.PartiallyConsistent, base.SessionSettings, 98, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\rms\\GetRMSTemplate.cs"); RmsTemplateType typeToFetch = (this.TrustedPublishingDomain != null) ? RmsTemplateType.All : RmsTemplateType.Distributed; bool flag = false; if (base.Fields.IsModified("Type")) { typeToFetch = this.Type; flag = true; } RMSTrustedPublishingDomain rmstrustedPublishingDomain = null; if (this.TrustedPublishingDomain != null) { rmstrustedPublishingDomain = (RMSTrustedPublishingDomain)base.GetDataObject <RMSTrustedPublishingDomain>(this.TrustedPublishingDomain, tenantOrTopologyConfigurationSession, null, new LocalizedString?(Strings.ErrorTrustedPublishingDomainNotFound(this.TrustedPublishingDomain.ToString())), new LocalizedString?(Strings.ErrorTrustedPublishingDomainNotUnique(this.TrustedPublishingDomain.ToString()))); } return(new RmsTemplateDataProvider(tenantOrTopologyConfigurationSession, typeToFetch, flag || rmstrustedPublishingDomain != null, rmstrustedPublishingDomain)); }
public void Save(IConfigurable instance) { if (this.orgId == OrganizationId.ForestWideOrgId) { throw new NotSupportedException(); } RmsTemplatePresentation rmsTemplatePresentation = instance as RmsTemplatePresentation; if (rmsTemplatePresentation == null) { throw new ArgumentException("passed in instance not of type RmsTemplatePresentation", "instance"); } Guid templateGuid = rmsTemplatePresentation.TemplateGuid; RMSTrustedPublishingDomain rmstrustedPublishingDomain = this.FindDefaultTPD(); if (rmstrustedPublishingDomain == null) { return; } if (!MultiValuedPropertyBase.IsNullOrEmpty(rmstrustedPublishingDomain.RMSTemplates)) { string text = null; string text2 = null; foreach (string text3 in rmstrustedPublishingDomain.RMSTemplates) { RmsTemplateType rmsTemplateType; string text4 = RMUtil.DecompressTemplate(text3, out rmsTemplateType); Guid templateGuidFromLicense = DrmClientUtils.GetTemplateGuidFromLicense(text4); if (templateGuidFromLicense == templateGuid && rmsTemplateType != rmsTemplatePresentation.Type) { text = text3; text2 = RMUtil.CompressTemplate(text4, rmsTemplatePresentation.Type); break; } } if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(text2)) { rmstrustedPublishingDomain.RMSTemplates.Remove(text); rmstrustedPublishingDomain.RMSTemplates.Add(text2); this.adSession.Save(rmstrustedPublishingDomain); } } }
public RmsTemplateDataProvider(IConfigurationSession adSession, RmsTemplateType typeToFetch, bool displayTemplatesIfInternalLicensingDisabled, RMSTrustedPublishingDomain trustedPublishingDomain) { if (adSession == null) { throw new ArgumentNullException("adSession"); } if (adSession.SessionSettings == null) { throw new ArgumentNullException("adSession.SessionSettings"); } this.adSession = adSession; this.orgId = adSession.SessionSettings.CurrentOrganizationId; this.typeToFetch = typeToFetch; this.displayTemplatesIfInternalLicensingDisabled = displayTemplatesIfInternalLicensingDisabled; this.irmConfiguration = IRMConfiguration.Read(this.adSession); this.trustedPublishingDomain = trustedPublishingDomain; }