protected virtual void Initialize(XDocument rulePackXDoc) { Version rulePackVersion = XmlProcessingUtils.GetRulePackVersion(rulePackXDoc); XElement rulePackageMetadataElement = XmlProcessingUtils.GetRulePackageMetadataElement(rulePackXDoc); bool isEncrypted = RulePackageDecrypter.IsRulePackageEncrypted(rulePackXDoc); this.Initialize(rulePackVersion, rulePackageMetadataElement, isEncrypted, XmlProcessingUtils.IsFingerprintRuleCollection(rulePackXDoc)); }
protected override void InternalValidate() { TaskLogger.LogEnter(); if (this.InstallDefaultCollection) { using (Stream stream = ClassificationDefinitionUtils.LoadStreamFromEmbeddedResource("DefaultClassificationDefinitions.xml")) { byte[] array = new byte[stream.Length]; stream.Read(array, 0, Convert.ToInt32(stream.Length)); this.FileData = array; goto IL_71; } } if (VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled) { this.ValidateOperationScope(); } IL_71: byte[] rulePackageRawData = null; byte[] array2 = null; try { this.isEncrypted = RulePackageDecrypter.DecryptRulePackage(this.FileData, out rulePackageRawData, out array2); } catch (Exception innerException) { base.WriteError(new ClassificationRuleCollectionDecryptionException(innerException), ErrorCategory.InvalidData, null); } if (this.isEncrypted) { ExAssert.RetailAssert(!this.InstallDefaultCollection, "Installation of encrypted default OOB rule pack is not supported due to versioning!"); string text = this.ValidateAndReadMetadata(rulePackageRawData); this.FileData = ((text == null) ? null : array2); } else { string text2 = this.ValidateAndReadMetadata(this.FileData); this.FileData = ((text2 == null) ? null : Encoding.Unicode.GetBytes(text2)); } if (this.FileData != null) { base.InternalValidate(); } TaskLogger.LogExit(); }
protected override void InternalValidate() { TaskLogger.LogEnter(); byte[] array = null; byte[] array2 = null; bool flag = false; try { flag = RulePackageDecrypter.DecryptRulePackage(this.FileData, out array, out array2); } catch (Exception innerException) { base.WriteError(new ClassificationRuleCollectionDecryptionException(innerException), ErrorCategory.InvalidData, null); } XDocument xdocument = this.ValidateAgainstSchema(flag ? array : this.FileData); this.SetIdentityParameter(xdocument); if (base.OptionalIdentityData != null) { base.OptionalIdentityData.ConfigurationContainerRdn = ClassificationDefinitionConstants.ClassificationDefinitionsRdn; } this.DataObject = (TransportRule)this.ResolveDataObject(); if (base.HasErrors) { return; } ExAssert.RetailAssert(this.DataObject != null, "DataObject must not be null at this point."); if (VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled) { this.ValidateOperationScope(); } string s = this.ValidateAgainstBusinessRulesAndReadMetadata(xdocument); this.FileData = (flag ? array2 : Encoding.Unicode.GetBytes(s)); base.InternalValidate(); TaskLogger.LogExit(); }
public static bool DecryptRulePackage(byte[] inputRulePackageData, out byte[] outputDecryptedRulePackageData, out byte[] outputEncryptedRulePackageDataWithSymmetricKey) { return(RulePackageDecrypter.DecryptRulePackage(new RulePackageDecrypter.InternalRulePackageDecrypter(inputRulePackageData), out outputDecryptedRulePackageData, out outputEncryptedRulePackageDataWithSymmetricKey)); }