protected override ReferenceList ReadReferenceListCore(XmlDictionaryReader reader)
        {
            ReferenceList list = new ReferenceList();

            list.ReadFrom(reader);
            return(list);
        }
        protected override ISecurityElement CompleteEncryptionCore(
            SendSecurityHeaderElement primarySignature,
            SendSecurityHeaderElement[] basicTokens,
            SendSecurityHeaderElement[] signatureConfirmations,
            SendSecurityHeaderElement[] endorsingSignatures)
        {
            if (this.referenceList == null)
            {
                return(null);
            }

            if (primarySignature != null && primarySignature.Item != null && primarySignature.MarkedForEncryption)
            {
                EncryptElement(primarySignature);
            }

            if (basicTokens != null)
            {
                for (int i = 0; i < basicTokens.Length; ++i)
                {
                    if (basicTokens[i].MarkedForEncryption)
                    {
                        EncryptElement(basicTokens[i]);
                    }
                }
            }

            if (signatureConfirmations != null)
            {
                for (int i = 0; i < signatureConfirmations.Length; ++i)
                {
                    if (signatureConfirmations[i].MarkedForEncryption)
                    {
                        EncryptElement(signatureConfirmations[i]);
                    }
                }
            }

            if (endorsingSignatures != null)
            {
                for (int i = 0; i < endorsingSignatures.Length; ++i)
                {
                    if (endorsingSignatures[i].MarkedForEncryption)
                    {
                        EncryptElement(endorsingSignatures[i]);
                    }
                }
            }

            try
            {
                return(this.referenceList.DataReferenceCount > 0 ? this.referenceList : null);
            }
            finally
            {
                this.referenceList = null;
                this.encryptingSymmetricAlgorithm = null;
                this.encryptionKeyIdentifier      = null;
            }
        }
 protected override void StartEncryptionCore(SecurityToken token, SecurityKeyIdentifier keyIdentifier)
 {
     this.encryptingSymmetricAlgorithm = System.ServiceModel.Security.SecurityUtils.GetSymmetricAlgorithm(this.EncryptionAlgorithm, token);
     if (this.encryptingSymmetricAlgorithm == null)
     {
         throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(System.ServiceModel.SR.GetString("UnableToCreateSymmetricAlgorithmFromToken", new object[] { this.EncryptionAlgorithm })));
     }
     this.encryptionKeyIdentifier = keyIdentifier;
     this.referenceList           = new ReferenceList();
 }
        protected override ISecurityElement CompleteEncryptionCore(SendSecurityHeaderElement primarySignature, SendSecurityHeaderElement[] basicTokens, SendSecurityHeaderElement[] signatureConfirmations, SendSecurityHeaderElement[] endorsingSignatures)
        {
            ISecurityElement element;

            if (this.referenceList == null)
            {
                return(null);
            }
            if (((primarySignature != null) && (primarySignature.Item != null)) && primarySignature.MarkedForEncryption)
            {
                this.EncryptElement(primarySignature);
            }
            if (basicTokens != null)
            {
                for (int i = 0; i < basicTokens.Length; i++)
                {
                    if (basicTokens[i].MarkedForEncryption)
                    {
                        this.EncryptElement(basicTokens[i]);
                    }
                }
            }
            if (signatureConfirmations != null)
            {
                for (int j = 0; j < signatureConfirmations.Length; j++)
                {
                    if (signatureConfirmations[j].MarkedForEncryption)
                    {
                        this.EncryptElement(signatureConfirmations[j]);
                    }
                }
            }
            if (endorsingSignatures != null)
            {
                for (int k = 0; k < endorsingSignatures.Length; k++)
                {
                    if (endorsingSignatures[k].MarkedForEncryption)
                    {
                        this.EncryptElement(endorsingSignatures[k]);
                    }
                }
            }
            try
            {
                element = (this.referenceList.DataReferenceCount > 0) ? this.referenceList : null;
            }
            finally
            {
                this.referenceList = null;
                this.encryptingSymmetricAlgorithm = null;
                this.encryptionKeyIdentifier      = null;
            }
            return(element);
        }
Пример #5
0
 protected override void ReadAdditionalElements(XmlDictionaryReader reader)
 {
     if (reader.IsStartElement(ReferenceList.ElementName, EncryptedType.NamespaceUri))
     {
         _referenceList = new ReferenceList();
         _referenceList.ReadFrom(reader);
     }
     if (reader.IsStartElement(CarriedKeyElementName, EncryptedType.NamespaceUri))
     {
         reader.ReadStartElement(CarriedKeyElementName, EncryptedType.NamespaceUri);
         _carriedKeyName = reader.ReadString();
         reader.ReadEndElement();
     }
 }
Пример #6
0
 protected override void ReadAdditionalElements(XmlDictionaryReader reader)
 {
     if (reader.IsStartElement(ReferenceList.ElementName, EncryptedType.NamespaceUri))
     {
         this.referenceList = new ReferenceList();
         this.referenceList.ReadFrom(reader);
     }
     if (reader.IsStartElement(CarriedKeyElementName, EncryptedType.NamespaceUri))
     {
         reader.ReadStartElement(CarriedKeyElementName, EncryptedType.NamespaceUri);
         this.carriedKeyName = reader.ReadString();
         reader.ReadEndElement();
     }
 }
 protected override void StartEncryptionCore(SecurityToken token, SecurityKeyIdentifier keyIdentifier)
 {
     this.encryptingSymmetricAlgorithm = SecurityUtils.GetSymmetricAlgorithm(this.EncryptionAlgorithm, token);
     if (this.encryptingSymmetricAlgorithm == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(
             SR.GetString(SR.UnableToCreateSymmetricAlgorithmFromToken, this.EncryptionAlgorithm)));
     }
     this.encryptionKeyIdentifier = keyIdentifier;
     this.referenceList = new ReferenceList();
 }
        protected override ISecurityElement CompleteEncryptionCore(
            SendSecurityHeaderElement primarySignature,
            SendSecurityHeaderElement[] basicTokens,
            SendSecurityHeaderElement[] signatureConfirmations,
            SendSecurityHeaderElement[] endorsingSignatures)
        {
            if (this.referenceList == null)
            {
                return null;
            }

            if (primarySignature != null && primarySignature.Item != null && primarySignature.MarkedForEncryption)
            {
                EncryptElement(primarySignature);
            }

            if (basicTokens != null)
            {
                for (int i = 0; i < basicTokens.Length; ++i)
                {
                    if (basicTokens[i].MarkedForEncryption)
                        EncryptElement(basicTokens[i]);
                }
            }

            if (signatureConfirmations != null)
            {
                for (int i = 0; i < signatureConfirmations.Length; ++i)
                {
                    if (signatureConfirmations[i].MarkedForEncryption)
                        EncryptElement(signatureConfirmations[i]);
                }
            }

            if (endorsingSignatures != null)
            {
                for (int i = 0; i < endorsingSignatures.Length; ++i)
                {
                    if (endorsingSignatures[i].MarkedForEncryption)
                        EncryptElement(endorsingSignatures[i]);
                }
            }

            try
            {
                return this.referenceList.DataReferenceCount > 0 ? this.referenceList : null;
            }
            finally
            {
                this.referenceList = null;
                this.encryptingSymmetricAlgorithm = null;
                this.encryptionKeyIdentifier = null;
            }
        }
 protected override ISecurityElement CompleteEncryptionCore(SendSecurityHeaderElement primarySignature, SendSecurityHeaderElement[] basicTokens, SendSecurityHeaderElement[] signatureConfirmations, SendSecurityHeaderElement[] endorsingSignatures)
 {
     ISecurityElement element;
     if (this.referenceList == null)
     {
         return null;
     }
     if (((primarySignature != null) && (primarySignature.Item != null)) && primarySignature.MarkedForEncryption)
     {
         this.EncryptElement(primarySignature);
     }
     if (basicTokens != null)
     {
         for (int i = 0; i < basicTokens.Length; i++)
         {
             if (basicTokens[i].MarkedForEncryption)
             {
                 this.EncryptElement(basicTokens[i]);
             }
         }
     }
     if (signatureConfirmations != null)
     {
         for (int j = 0; j < signatureConfirmations.Length; j++)
         {
             if (signatureConfirmations[j].MarkedForEncryption)
             {
                 this.EncryptElement(signatureConfirmations[j]);
             }
         }
     }
     if (endorsingSignatures != null)
     {
         for (int k = 0; k < endorsingSignatures.Length; k++)
         {
             if (endorsingSignatures[k].MarkedForEncryption)
             {
                 this.EncryptElement(endorsingSignatures[k]);
             }
         }
     }
     try
     {
         element = (this.referenceList.DataReferenceCount > 0) ? this.referenceList : null;
     }
     finally
     {
         this.referenceList = null;
         this.encryptingSymmetricAlgorithm = null;
         this.encryptionKeyIdentifier = null;
     }
     return element;
 }
 protected override void ProcessReferenceListCore(ReferenceList referenceList, WrappedKeySecurityToken wrappedKeyToken)
 {
     this.pendingReferenceList   = referenceList;
     this.pendingDecryptionToken = wrappedKeyToken;
 }
 protected override ReferenceList ReadReferenceListCore(XmlDictionaryReader reader)
 {
     ReferenceList referenceList = new ReferenceList();
     referenceList.ReadFrom(reader);
     return referenceList;
 }
 protected override void ProcessReferenceListCore(ReferenceList referenceList, WrappedKeySecurityToken wrappedKeyToken)
 {
     this.pendingReferenceList = referenceList;
     this.pendingDecryptionToken = wrappedKeyToken;
 }
 public void AppendReferenceList(ReferenceList referenceList)
 {
     AppendElement(ReceiveSecurityHeaderElementCategory.ReferenceList, referenceList,
                   ReceiveSecurityHeaderBindingModes.Unknown, null, null);
 }