In the below description RP refers to "Relying Party" or the "Service" and STS refers to "Security Token Service".
RP's WSDL contains the following elements in the RequestSecurityTokenTemplate.
Client Config contains a list of parameters.
WCF cannot differentiate between client and service parameters. We just add all the parameters and send them over the RST.
Client config contains a "secondaryParamters" element that wraps the RP specified parameters.
WCF removes the EncryptionAlgorithm, CanonicalizationAlgorithm and KeyWrapAlgorithm from the top-level element under the RST if these are present inside the SecondaryParameters. We append the SecondaryParamters element as is to the outgoing RST.
WCF cannot differentiate between the Service and Client parameters in this case from config on the client side. So we convert all the parameters to Trust 1.3 namespace.
Our handling of KeyType, KeySize and TokenType elements in this case is as follows,
WCF converts only EncryptionAlgorithm and CanonicalizationAlgorithm specified inside the "SecondaryParameters" and move them as top-level under the RST and replace the client specified values. The "SecondaryParameters" element is dropped from the AdditionalRequestParameters.