<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright(C) 2003-2013 ООО "Крипто-Про"

    Этот файл содержит информацию, являющуюся
    собственностью компании Крипто Про.

    Любая часть этого файла не может быть скопирована,
    исправлена, переведена на другие языки,
    локализована или модифицирована любым способом,
    откомпилирована, передана по сети с или на
    любую компьютерную систему без предварительного
    заключения соглашения с компанией Крипто Про.


    \file $RCSfile$
    \version $Revision: 98885 $
    \date $Date: 2013-12-06 11:09:17 +0400 (Пт, 06 дек 2013) $

    \author Леонтьев С.Е. (последнее исправление: $Author: spv $)
  -->

<!-- необходимо или нет написание изменения DTD на xmlenc,
  и где найти DTD на xmlenc -->
<!-- Изменения в DTD для xmldsig -->

<!DOCTYPE rfc SYSTEM "http://xml.resource.org/authoring/rfc2629.dtd" [
    <!ENTITY nbsp    "&#160;" >
    <!-- U+00A0 NO-BREAK SPACE                             (special " ")
    -->
    <!ENTITY hmac PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml/rfc.2104.xml'>
    <!ENTITY keywords PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml/rfc.2119.xml'>
    <!ENTITY rfc3986 PUBLIC ''
    'http://xml.resource.org/public/rfc/bibxml/reference.RFC.3986.xml'>
    <!ENTITY rfc4134 PUBLIC ''
    'http://xml.resource.org/public/rfc/bibxml/reference.RFC.4134.xml'>
    <!ENTITY rfc4648 PUBLIC ''
    'http://xml.resource.org/public/rfc/bibxml/reference.RFC.4648.xml'>
    <!ENTITY rfc3688 PUBLIC ''
    'http://xml.resource.org/public/rfc/bibxml/reference.RFC.3688.xml'>
    <!ENTITY xml-schema-1 PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml2/w3c.xmlschema-1.xml'>
    <!ENTITY xml-schema-2 PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml2/w3c.xmlschema-2.xml'>
    <!ENTITY xml-core PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml2/w3c.xml.xml'>
    <!ENTITY xml-ns PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml2/w3c.xml-ns.xml'>
    <!ENTITY xmldsig PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml/rfc.3275.xml'>
    <!ENTITY xmlenc-core PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml2/w3c.xmlenc-core.xml'>
    <!ENTITY cpalgs PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml/rfc.4357.xml'>
    <!ENTITY cpcms PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml/rfc.4490.xml'>
    <!ENTITY cppk PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml/rfc.4491.xml'>
    <!ENTITY cptls PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml3/reference.I-D.chudov-cryptopro-cptls.xml'>
    <!ENTITY gost28147 PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml2/gost.28147.xml'>
    <!ENTITY gostr341094 PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml2/gost.r341094.xml'>
    <!ENTITY gostr341001 PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml2/gost.r341001.xml'>
    <!ENTITY gostr341194 PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml2/gost.r341194.xml'>
    <!ENTITY gost3431095 PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml2/gost.3431095.xml'>
    <!ENTITY gost3431004 PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml2/gost.3431004.xml'>
    <!ENTITY gost3431195 PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml2/gost.3431195.xml'>
    <!ENTITY asn1 PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml2/x208-88.xml'>
    <!ENTITY ws-security PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml2/oasis.wss-v1.1-spec-os-SOAPMessageSecurity.xml'>
    <!ENTITY ws-secureconversation PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml2/oasis.ws-secureconversation-1.3-os.xml'>
    <!ENTITY ws-securitypolicy PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml2/oasis.ws-securitypolicy-1.2-spec-os.xml'>
    <!ENTITY ws-policy PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml2/w3c.ws-policy.xml'>
    <!ENTITY ws-trust PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml2/oasis.ws-trust-1.3-os.xml'>
    <!ENTITY ws-trust-tls PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml2/WSTrustForTLS.xml'>
    <!ENTITY tls PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml/reference.rfc.5246.xml'>
    <!ENTITY urnoid PUBLIC ''
    'http://www.cryptopro.ru/pub/drafts/bibxml/reference.rfc.3061.xml'>
]>

<?xml-stylesheet type='text/xsl' href='http://www.cryptopro.ru/pub/drafts/xml2rfc/rfc2629xslt/rfc2629.xslt' ?>
<?rfc toc="yes" ?>
<?rfc compact="yes" ?>
<?rfc symrefs="yes" ?>
<?rfc sortrefs="yes"?>
<?rfc iprnotified="no" ?>
<?rfc strict="yes" ?>

<rfc category="info" ipr="trust200902" docName="draft-chudov-cryptopro-cpxmldsig-08" obsoletes="" updates="" submissionType="IETF" xml:lang="en">
    <front>

        <title abbrev='Using GOST Algorithms for XML Security'>
            Using GOST 28147-89, GOST R 34.10, and
            GOST R 34.11 Algorithms for XML Security
        </title>

        <author initials='S.E.' surname='Leontiev'
            fullname='Serguei E. Leontiev'>
	  <organization abbrev="CRYPTO-PRO">"CRYPTO-PRO", LLC</organization>
	  <address>
	    <postal>
	      <street>18, Suschevsky Val str.</street>
	      <country>Russian Federation</country>
	      <code>127018</code>
	      <city>Moscow</city>
	    </postal>
	    <phone>+7 (916) 686 10 81</phone>
	    <facsimile>+74957804820</facsimile>
	    <email>lse@cryptopro.ru</email>
	    <uri>http://www.cryptopro.ru</uri>
	  </address>
	</author>

        <author initials='P.V.' surname='Smirnov'
            fullname='Pavel V. Smirnov'>
	  <organization abbrev="CRYPTO-PRO">"CRYPTO-PRO", LLC</organization>
	  <address>
	    <postal>
	      <street>18, Suschevsky Val str.</street>
	      <country>Russian Federation</country>
	      <code>127018</code>
	      <city>Moscow</city>
	    </postal>
	    <phone>+7 (495) 780 4820</phone>
	    <facsimile>+74957804820</facsimile>
	    <email>spv@CryptoPro.ru</email>
	    <uri>http://www.CryptoPro.ru</uri>
	  </address>
	</author>

        <author initials='A.V.' surname='Chelpanov'
            fullname='Aleksandr V. Chelpanov'>
          <organization abbrev="InfoTeCS">JSC "InfoTeCS"</organization>
	  <address>
	    <postal>
		<street>build 1, 1/23, Staryj Petrovsko-Razumovsij pr.</street>
		<city>Moscow</city>
		<code>127287</code>
		<country>Russia</country>
	    </postal>
	    <phone>+7 (495) 737-6192</phone>
	    <facsimile>+7 (495) 737-7278</facsimile>
	    <email>Aleksandr.Chelpanov@infotecs.ru</email>
	  </address>
	</author>

        <date month="December" year="2013"/>

        <area>Security</area>

        <keyword>GOST 28147-89</keyword>
        <keyword>GOST R 34.11-94</keyword>
        <keyword>GOST R 34.11-2012</keyword>
        <keyword>GOST R 34.10-94</keyword>
        <keyword>GOST R 34.10-2001</keyword>
        <keyword>GOST R 34.10-2012</keyword>
        <keyword>GOST 34.310-95</keyword>
        <keyword>GOST 34.311-95</keyword>
        <keyword>GOST 34.310-2004</keyword>
        <!-- TODO: ???? -->

        <abstract>

            <t>
                This document specifies how to use Russian national
                cryptographic standards GOST&nbsp;28147-89,
                GOST&nbsp;R&nbsp;34.10 and GOST&nbsp;R&nbsp;34.11
                with XML Signatures, XML Encryption, WS-SecureConversation,
                WS-SecurityPolicy and WS-Trust.
                A number of Uniform Resource Identifiers (URIs) and XML
                elements are defined.
            </t>

        </abstract>
    </front>

    <middle>
        <section title='Introduction'>

            <t>
                This document specifies how to use
                GOST&nbsp;R&nbsp;34.10 digital signatures and
                public keys, GOST&nbsp;R&nbsp;34.11 hash,
                GOST&nbsp;28147-89 encryption algorithms
                with XML Signatures <xref target='XMLDSIG'/>,
                XML Encryption <xref target='XMLENC-CORE'/>,
                WS-SecureConversation <xref target='WS-SECURECONVERSATION'/>,
                WS-SecurityPolicy <xref target='WS-SECURITYPOLICY'/> and
                WS-Trust <xref target='WS-TRUST'/>.
            </t>

            <t>
                This document uses both XML Schema (<xref target='XML-SCHEMA-1'/>,
                <xref target='XML-SCHEMA-2'/>)
                (normative) and DTD <xref target='XML'/> (informational) to
                specify the corresponding XML structures.
            </t>

            <t>
                The key words "MUST", "MUST NOT", "REQUIRED",
                "SHALL", "SHALL NOT","SHOULD", "SHOULD NOT",
                "RECOMMENDED", "MAY", and "OPTIONAL" in this document
                are to be interpreted as described in <xref
      target='KEYWORDS'/>.
            </t>

        </section>

        <section title='GOST Cryptographic Algorithms'>

            <t>
                Algorithms GOST&nbsp;R&nbsp;34.10-2001,
                GOST&nbsp;R&nbsp;34.11-94 and GOST 28147-89 have
                been developed by Russian
                Federal Agency of Governmental Communication and
                Information (FAGCI) and "All-Russian Scientific and
                Research Institute of Standardization". They are
                described in <xref target='GOSTR341001'/>,
                <xref target='GOSTR341194'/> (<xref target='GOST3431004'/> and
                <xref target='GOST3431195'/>) and
                <xref target='GOST28147'/>.  RECOMMENDED parameters for those
                algorithms are described in <xref target='CPALGS'/>.
            </t>

        </section>

        <section title='Version and Namespaces'>

            <t>
                This specification makes no provision for an explicit version
                number in the syntax. If a future version is needed, it will
                use a different namespace.
            </t>

            <t>
                The XML namespace <xref target='XML-NS'/>
                <xref target='RFC3986'>URI</xref> that MUST be used
                by implementations of this (dated) specification is:

                <list>
                    <t/>
                    <t>
                        urn:ietf:params:xml:ns:cpxmlsec
                    </t>
                </list>
            </t>

            <t>
                The following external XML namespaces are used in this
                specification (without line breaks; the choice of any
                namespace prefix is arbitrary and not semantically
                significant):
                <list>
                    <t/>
                    <t>
                        http://www.w3.org/2000/09/xmldsig#
                        <list>
                            <t>
                                Prefix:
                                <list>
                                    <t>
                                        dsig
                                    </t>
                                </list>
                            </t>
                            <t>
                                Specification:
                                <list>
                                    <t>
                                        <xref target='XMLDSIG'/>
                                    </t>
                                </list>
                            </t>
                        </list>
                    </t>
                    <t/>
                    <t>
                        http://www.w3.org/2001/04/xmlenc#
                        <list>
                            <t>
                                Prefix:
                                <list>
                                    <t>
                                        xenc
                                    </t>
                                </list>
                            </t>
                            <t>
                                Specification:
                                <list>
                                    <t>
                                        <xref target='XMLENC-CORE'/>
                                    </t>
                                </list>
                            </t>
                        </list>
                    </t>
                    <t/>
                    <t>
                        http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702
                        <list>
                            <t>
                                Prefix:
                                <list>
                                    <t>
                                        sp
                                    </t>
                                </list>
                            </t>
                            <t>
                                Specification:
                                <list>
                                    <t>
                                        <xref target='WS-SECURITYPOLICY'/>
                                    </t>
                                </list>
                            </t>
                        </list>
                    </t>
                    <t/>
                    <t>
                        http://www.w3.org/ns/ws-policy
                        <list>
                            <t>
                                Prefix:
                                <list>
                                    <t>
                                        wsp
                                    </t>
                                </list>
                            </t>
                            <t>
                                Specification:
                                <list>
                                    <t>
                                        <xref target='WS-POLICY'/>
                                    </t>
                                </list>
                            </t>
                        </list>
                    </t>
                    <t/>
                    <t>
                        http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512
                        <list>
                            <t>
                                Prefix:
                                <list>
                                    <t>
                                        wsc
                                    </t>
                                </list>
                            </t>
                            <t>
                                Specification:
                                <list>
                                    <t>
                                        <xref target='WS-SECURECONVERSATION'/>
                                    </t>
                                </list>
                            </t>
                        </list>
                    </t>
                    <t/>
                    <t>
                        http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
                        <list>
                            <t>
                                Prefix:
                                <list>
                                    <t>
                                        wsse
                                    </t>
                                </list>
                            </t>
                            <t>
                                Specification:
                                <list>
                                    <t>
                                        <xref target='WS-SECURITY'/>
                                    </t>
                                </list>
                            </t>
                        </list>
                    </t>
                    <t/>
                    <t>
                        http://docs.oasis-open.org/ws-sx/ws-trust/200512/
                        <list>
                            <t>
                                Prefix:
                                <list>
                                    <t>
                                        wst
                                    </t>
                                </list>
                            </t>
                            <t>
                                Specification:
                                <list>
                                    <t>
                                        <xref target='WS-TRUST'/>
                                    </t>
                                </list>
                            </t>
                        </list>
                    </t>
                </list>
            </t>

            <t>
                In the remaining sections of this document elements
                in the external namespaces are marked as
                such by using the namespace prefixes defined above.
            </t>

        </section>

        <section title='XML Schema Preamble and DTD Replacement'>

            <section title='XML Schema Preamble'>

                <t>
                    The subsequent preamble is to be used with the XML
                    Schema definitions given in the remaining sections of this
                    document.
                </t>

                <figure>
                    <artwork>
<![CDATA[  <xs:schema 
    xmlns:cpxmlsec="urn:ietf:params:xml:ns:cpxmlsec"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:sp=
    "http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"
    targetNamespace="urn:ietf:params:xml:ns:cpxmlsec"
    elementFormDefault="qualified"
    version="0.4">]]>
                    </artwork>
                </figure>

            </section>

            <section title='DTD Replacement'>

                <t>
                    In order to include GOST XML-signature syntax, the
                    following definition of the entity Key.ANY SHOULD replace
                    the one in <xref target='XMLDSIG'/>:
                </t>

                <figure>
                    <artwork>
<![CDATA[  <!ENTITY % KeyValue.ANY '| cpxmlsec:GOSTKeyValue'>]]>
                    </artwork>
                </figure>
            </section>

        </section>

        <section title='Object Identifiers Representation'>

            <t>
                Object Identifiers (OIDs) are included in XML by the
                corresponding URN value as defined in <xref target='URNOID'/>.
            </t>

            <figure>
                <preamble>
                    The subsequent type is to be used to define algorithm
                    parameters by OIDs:
                </preamble>

                <artwork>
<![CDATA[  <xs:simpleType name="ObjectIdentifierType">
    <xs:restriction base="xs:anyURI">
      <xs:pattern value=
        "urn:oid:(([0-1]\.[1-3]?\d)|(2\.\d+))(\.\d+)*" />
    </xs:restriction>
  </xs:simpleType>]]>
                </artwork>
            </figure>

        </section>

        <section title='Specifying GOST within XML Signature and XML Encryption'>

            <t>
                This section specifies the details of how to use GOST
                algorithms with XML
                Signature Syntax and Processing <xref target='XMLDSIG'/> and XML
                Encryption Syntax and Processing <xref target='XMLENC-CORE'/>.
                It relies heavily on
                syntaxes and namespaces defined in <xref target='XMLDSIG'/>
                and <xref target='XMLENC-CORE'/>.
            </t>

            <section title='GOST R 34.11-94 Algorithm in DigestMethod'
                     anchor='GOST3411DigestMethod'>

                <t>
                    The identifier for the GOST&nbsp;R&nbsp;34.11-94 digest
                    algorithm is:

                    <list>
                        <t/>
                        <t>
                            urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411
                        </t>
                    </list>
                </t>

                <t>
                    The dsig:DigestMethod node may contain a child node
                    cpxmlsec:ParametersR3411 specifying parameters for
                    GOST&nbsp;R&nbsp;34.11-94 algorithm. cpxmlsec:ParametersR3411
                    node contains one OID specified in section 8.2
                    <xref target='CPALGS'/>.
                    If cpxmlsec:ParametersR3411 node is missing, the
                    application should infer algorithm parameters from other
                    sources.
                </t>

                <t>
                    If the application omits cpxmlsec:ParametersR3411 node, it SHOULD
                    use parameters defined by
                    id-GostR3411-94-CryptoProParamSet
                    (see Section 11.2 of <xref target='CPALGS'/>).
                </t>

                <figure>
                    <preamble> Schema Definition: </preamble>

                    <artwork>
<![CDATA[  <xs:element name="ParametersR3411"
              type="cpxmlsec:ObjectIdentifierType"/>]]>
                    </artwork>
                </figure>

                <figure>
                    <preamble> DTD Definition: </preamble>

                    <artwork>
<![CDATA[  <!ELEMENT ParametersR3411 (#PCDATA) >]]>
                    </artwork>
                </figure>

                <figure>
                    <preamble>
                        An example of a GOST&nbsp;R&nbsp;34.11-94
                        dsig:DigestMethod node is:
                    </preamble>

                    <artwork>
<![CDATA[  <dsig:DigestMethod dsig:Algorithm=
      "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411">
    <!-- id-GostR3411-94-CryptoProParamSet -->
    <cpxmlsec:ParametersR3411>urn:oid:1.2.643.2.2.30.1<
    /cpxmlsec:ParametersR3411>
  </dsig:DigestMethod>]]>
                    </artwork>
                </figure>

                <t>
                    A GOST&nbsp;R&nbsp;34.11-94 digest is a 256-bit string.
                    The content of the dsig:DigestValue element shall be the
                    base64 <xref target='RFC4648'/> encoding of this bit string
                    viewed as a 32-octet octet stream.
                </t>

            </section>

            <section title='GOST R 34.11-2012 Algorithm with 256-bit output in DigestMethod'
                     anchor='GOST34112012256DigestMethod'>

                <t>
                    The identifier for the GOST&nbsp;R&nbsp;34.11-2012 digest
                    algorithm with 256-bit output is:

                    <list>
                        <t>
                            urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256
                        </t>
                    </list>
                </t>

                <figure>
                    <preamble>
                        An example of a GOST&nbsp;R&nbsp;34.11-2012 with 256-bit output
                        dsig:DigestMethod node is:
                    </preamble>

                    <artwork>
<![CDATA[  <dsig:DigestMethod dsig:Algorithm=
      "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256" />]]>
                    </artwork>
                </figure>

                <t>
                    A GOST&nbsp;R&nbsp;34.11-2012 digest in this case is a 256-bit string.
                    The content of the dsig:DigestValue element shall be the
                    base64 <xref target='RFC4648'/> encoding of this bit string
                    viewed as a 32-octet octet stream.
                </t>

            </section>
            
            <section title='GOST R 34.11-2012 Algorithm with 512-bit output in DigestMethod'
                     anchor='GOST34112012512DigestMethod'>

                <t>
                    The identifier for the GOST&nbsp;R&nbsp;34.11-2012 digest
                    algorithm with 512-bit output is:

                    <list>
                        <t>
                            urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-512
                        </t>
                    </list>
                </t>

                <figure>
                    <preamble>
                        An example of a GOST&nbsp;R&nbsp;34.11-2012 with 512-bit output
                        dsig:DigestMethod node is:
                    </preamble>

                    <artwork>
<![CDATA[  <dsig:DigestMethod dsig:Algorithm=
      "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-512" />]]>
                    </artwork>
                </figure>

                <t>
                    A GOST&nbsp;R&nbsp;34.11-2012 digest in this case is a 512-bit string.
                    The content of the dsig:DigestValue element shall be the
                    base64 <xref target='RFC4648'/> encoding of this bit string
                    viewed as a 64-octet octet stream.
                </t>

            </section>
            
            <section title='GOST R 34.11-94 HMAC Algorithm in SignatureMethod'>

                <t>
                    GOST&nbsp;R&nbsp;34.11-94 can also be used in HMAC
                    <xref target='HMAC'/> as described in
                    section 6.3.1 of <xref target='XMLDSIG'/>.
                    Identifier:

                    <list>
                        <t/>
                        <t>
                            urn:ietf:params:xml:ns:cpxmlsec:algorithms:hmac-gostr3411
                        </t>
                    </list>
                </t>

                <t>
                    The dsig:SignatureMethod node may contain a child node
                    cpxmlsec:ParametersR3411 specifying parameters for
                    GOST&nbsp;R&nbsp;34.11-94 algorithm. cpxmlsec:ParametersR3411 node
                    syntax and processing in this case are equivalent to the ones
                    in dsig:DigestMethod case.
                </t>

                <figure>
                    <preamble>
                        An example of a GOST&nbsp;R&nbsp;34.11-94 HMAC 
                        disg:SignatureMethod node is:
                    </preamble>

                    <artwork>
<![CDATA[  <dsig:SignatureMethod dsig:Algorithm=
      "urn:ietf:params:xml:ns:cpxmlsec:algorithms:hmac-gostr3411">
    <!-- id-GostR3411-94-CryptoProParamSet -->
    <cpxmlsec:ParametersR3411>urn:oid:1.2.643.2.2.30.1<
    /cpxmlsec:ParametersR3411>
  </dsig:SignatureMethod>]]>
                    </artwork>
                </figure>

                <t>
                    The output of the GOST&nbsp;R&nbsp;34.11-94 HMAC algorithm is
                    ultimately the output of the GOST&nbsp;R&nbsp;34.11-94 digest
                    algorithm. This value shall be base64 <xref target='RFC4648'/>
                    encoded for the dsig:SignatureValue in the same straightforward
                    fashion as the output of the digest algorithm in
                    <xref target='GOST3411DigestMethod'/>.
                </t>

            </section>

            <section title='GOST R 34.10-2001 Algorithm in SignatureMethod'>

                <t>
                    The input to the GOST&nbsp;R&nbsp;34.10-2001 algorithm
                    is the canonicalized
                    representation of the dsig:SignedInfo element as
                    specified in Section 3 of <xref target='XMLDSIG'/>.
                </t>

                <t>
                    The identifier for the GOST&nbsp;R&nbsp;34.10-2001
                    signature algorithm is (without line break):

                    <list>
                        <t/>
                        <t>
                            urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411
                        </t>
                    </list>
                </t>

                <figure>
                    <preamble>
                        An example of a GOST&nbsp;R&nbsp;34.10-2001
                        dsig:SignatureMethod node is (without line break in
                        attribute value):
                    </preamble>

                    <artwork>
<![CDATA[  <dsig:SignatureMethod dsig:Algorithm=
  "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-
  gostr3411" />]]>
                    </artwork>
                </figure>
                
                <t>
                    GOST&nbsp;R&nbsp;34.10-2001 signature is a 64-octet value as
                    described in section 2.2.2 of <xref target='CPPK'/>. The
                    content of the dsig:SignatureValue element shall be the
                    base64 [RFC4648] encoding of this value.
                </t>

            </section>

            <section title='GOST R 34.10-2012 Algorithm in SignatureMethod'>

                <t>
                    The input to the GOST&nbsp;R&nbsp;34.10-2012 algorithm
                    is the canonicalized
                    representation of the dsig:SignedInfo element as
                    specified in Section 3 of <xref target='XMLDSIG'/>.
                </t>

                <t>
                    The identifiers for the GOST&nbsp;R&nbsp;34.10-2012
                    signature algorithm are (without line breaks):

                    <list>
                        <t/>
                        <t>
                            urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256
                        </t>
                        <t>
                            urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-512
                        </t>
                    </list>
                </t>

                <t>
                    Both identifiers refer to GOST R 34.11-2012 as digest
                    algorithm. The first one denotes that the 256-bit output
                    version of that algorithm is used, the second one
                    corresponds to 512-bit output.
                </t>
                
                <figure>
                    <preamble>
                        An example of a GOST&nbsp;R&nbsp;34.10-2012
                        dsig:SignatureMethod node is (without line break in
                        attribute value):
                    </preamble>

                    <artwork>
<![CDATA[  <dsig:SignatureMethod dsig:Algorithm=
  "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-
  gostr34112012-256" />]]>
                    </artwork>
                </figure>

            </section>

            <section title='GOST R 34.10-2001 Public Key in KeyValue'>
                <section title='Key Value Root Element'>

                    <t>
                        GOST R 34.10-2001 public key can be transmitted in
                        cpxmlsec:GOSTKeyValue node. It is included in
                        dsig:KeyValue node just like dsig:RSAKeyValue or
                        xenc:DHKeyValue.
                    </t>

                    <t>
                        cpxmlsec:GOSTKeyValue node consists of an optional child
                        node cpxmlsec:PublicKeyParameters and a mandatory child
                        node cpxmlsec:PublicKey. If cpxmlsec:PublicKeyParameters node
                        is missing, the application should infer parameters
                        from other sources.
                    </t>

                    <figure>
                        <preamble> Schema Definition:</preamble>

                        <artwork>
<![CDATA[  <xs:element name="GOSTKeyValue"
              type="cpxmlsec:KeyValueType"/>
  
  <xs:complexType name="KeyValueType">
    <xs:sequence>
      <xs:element name="PublicKeyParameters"
                  type="cpxmlsec:PublicKeyParametersType"
                  minOccurs="0"/>
      <xs:element name="PublicKey" type="xs:base64Binary"/>
    </xs:sequence>
  </xs:complexType>]]>
                        </artwork>
                    </figure>

                    <figure>
                        <preamble> DTD Definition:</preamble>

                        <artwork>
<![CDATA[  <!ELEMENT GOSTKeyValue (
              PublicKeyParameters?, PublicKey) >
  <!ELEMENT PublicKey (#PCDATA) >]]>
                        </artwork>
                    </figure>

                    <t>
                        If the application omits cpxmlsec:PublicKeyParameters node,
                        it SHOULD use parameters identified by
                        DefaultPublicKeyParameters.
                    </t>

                    <figure>
                        <preamble>DefaultPublicKeyParameters:</preamble>

                        <artwork>
<![CDATA[  <cpxmlsec:PublicKeyParameters>
    <!-- id-GostR3410-2001-CryptoPro-A-ParamSet -->
    <cpxmlsec:publicKeyParamSet>urn:oid:1.2.643.2.2.35.1<
    /cpxmlsec:publicKeyParamSet> 
    <!-- id-GostR3411-94-CryptoProParamSet -->
    <cpxmlsec:digestParamSet>urn:oid:1.2.643.2.2.30.1</
    cpxmlsec:digestParamSet>
    <!-- id-Gost28147-89-CryptoPro-A-ParamSet -->
    <cpxmlsec:encryptionParamSet>urn:oid:1.2.643.2.2.31.1</
    cpxmlsec:encryptionParamSet>
  </cpxmlsec:PublicKeyParameters>
            ]]>
                        </artwork>
                    </figure>

                </section>

                <section title='Public Key Parameters'>

                    <t>
                        cpxmlsec:PublicKeyParameters node contains three OIDs:
                        cpxmlsec:publicKeyParamSet, cpxmlsec:digestParamSet and
                        optional cpxmlsec:encryptionParamSet. Parameter values
                        corresponding to these OIDs can be found in
                        <xref target='CPALGS'/>.
                    </t>

                    <figure>
                        <preamble> Schema Definition: </preamble>

                        <artwork>
<![CDATA[  <xs:complexType name="PublicKeyParametersType">
     <xs:sequence>
        <xs:element name="publicKeyParamSet"
                    type="cpxmlsec:ObjectIdentifierType"/>
        <xs:element name="digestParamSet"
                    type="cpxmlsec:ObjectIdentifierType"/>
        <xs:element name="encryptionParamSet"
                    type="cpxmlsec:ObjectIdentifierType"
                    minOccurs="0"/>
     </xs:sequence>
  </xs:complexType>]]>
                        </artwork>
                    </figure>

                    <figure>
                        <preamble> DTD Definition: </preamble>

                        <artwork>
<![CDATA[  <!ELEMENT PublicKeyParameters (
                 publicKeyParamSet, digestParamSet,
                 encryptionParamSet?) >
  <!ELEMENT publicKeyParamSet (#PCDATA) >
  <!ELEMENT digestParamSet (#PCDATA) >
  <!ELEMENT encryptionParamSet (#PCDATA) >]]>
                        </artwork>
                    </figure>

                </section>
            </section>

            <section title='GOST R 34.10-2001-based Key Agreement Algorithm in AgreementMethod'
                     anchor='GOST3410Agree'>

                <t>
                    Key agreement algorithm based on
                    GOST&nbsp;R&nbsp;34.10-2001 public keys (see Section 5 of
                    <xref target='CPALGS'/>) involves the derivation of shared
                    secret information using keys from the sender and
                    recipient.
                </t>

                <t>
                    The identifier for the key agreement algorithm based on
                    GOST&nbsp;R&nbsp;34.10-2001 is:

                    <list>
                        <t/>
                        <t>
                            urn:ietf:params:xml:ns:cpxmlsec:algorithms:agree-gost2001
                        </t>
                    </list>
                </t>

                <figure>
                    <preamble>
                        An example of a GOST&nbsp;R&nbsp;34.10-2001-based key
                        agreement AgreementMethod node is:
                    </preamble>

                    <artwork>
<![CDATA[  <xenc:AgreementMethod xenc:Algorithm=
      "urn:ietf:params:xml:ns:cpxmlsec:algorithms:agree-gost2001">
    <xenc:KA-Nonce>...</xenc:KA-Nonce>
    <xenc:OriginatorKeyInfo>
      <dsig:X509Data><dsig:X509Certificate>
        ...
      </dsig:X509Certificate></dsig:X509Data>
    </xenc:OriginatorKeyInfo>
    <xenc:RecipientKeyInfo><dsig:KeyValue>
      ...
    </dsig:KeyValue></xenc:RecipientKeyInfo>
  </xenc:AgreementMethod>]]>
                    </artwork>
                </figure>

                <t>
                    The shared keying material for algorithm based on
                    GOST&nbsp;R&nbsp;34.10-2001 needed will be calculated as
                    a result of function VKO GOST&nbsp;R&nbsp;34.10-2001
                    (see Section 5.2 of <xref target='CPALGS'/>),
                    which generates GOST KEK using two
                    GOST&nbsp;R&nbsp;34.10-2001 keypairs and UKM.
                    xenc:KA-Nonce node of xenc:AgreementMethod contains
                    base64 encoded 64-bits value of UKM, if UKM is used.
                </t>

            </section>

            <section title='GOST R 34.10-2001-based Key Transport Algorithm in EncryptionMethod'>

                <t>
                    The key transport algorithm based on
                    VKO GOST&nbsp;R&nbsp;34.10-2001, specified in
                    <xref target='CPALGS'/>, is public key encryption
                    algorithms, that MUST be used for key
                    encryption/decryption only.
                </t>

                <t>
                    The identifier for the key transport algorithm based on
                    VKO GOST&nbsp;R&nbsp;34.10-2001 is:

                    <list>
                        <t/>
                        <t>
                            urn:ietf:params:xml:ns:cpxmlsec:algorithms:transport-gost2001
                        </t>
                    </list>
                </t>

                <figure>
                    <preamble>
                        An example of a VKO GOST&nbsp;R&nbsp;34.10-2001-based key
                        transport EncryptedKey node is:
                    </preamble>

                    <artwork>
<![CDATA[  <xenc:EncryptedKey>
    <xenc:EncryptionMethod xenc:Algorithm=
  "urn:ietf:params:xml:ns:cpxmlsec:algorithms:transport-gost2001" />
    <dsig:KeyInfo>
      <dsig:X509Data><dsig:X509Certificate>
        ...
      </dsig:X509Certificate></dsig:X509Data>
    </dsig:KeyInfo>
    <xenc:CipherData>
        <xenc:CipherValue>...</xenc:CipherValue>
    </xenc:CipherData>
  </xenc:EncryptedKey>]]>
                    </artwork>
                </figure>

                <t>
                    The CipherValue for such encrypted key is the base64 encoding
                    of the <xref target='X.208-88'/> DER encoding of a
                    GostR3410-KeyTransport structure (see section 4.2.1 of
                    <xref target='CPCMS'/>).
                </t>

            </section>

            <section title='GOST 28147-89 Algorithm in EncryptionMethod'>

                <t>
                    The identifier for the GOST&nbsp;28147-89 symmetric
                    encryption algorithm is:
                    <list>
                        <t/>
                        <t>
                            urn:ietf:params:xml:ns:cpxmlsec:algorithms:gost28147
                        </t>
                    </list>
                </t>

                <t>
                    The xenc:EncryptionMethod node may contain a child node
                    cpxmlsec:Parameters28147 specifying parameters for
                    GOST&nbsp;28147-89 algorithm.
                    cpxmlsec:Parameters28147 specifies the set of corresponding
                    Gost28147-89-ParamSetParameters (see Section 8.1 of
                    <xref target='CPALGS'/>). Encryption mode is specified
                    by mode parameter of Gost28147-89-ParamSetParameters
                    structure. CFB and CNT modes are RECOMMENDED to use.
                    If cpxmlsec:Parameters28147 node is missing, the application
                    should infer algorithm parameters from other sources.
                </t>

                <t>
                    If the application omits cpxmlsec:Parameters28147 node, it
                    SHOULD use parameters defined by
                    id-Gost28147-89-CryptoPro-A-ParamSet (see Section of
                    10.2 [CPALGS]).
                </t>

                <figure>
                    <preamble> Schema Definition: </preamble>

                    <artwork>
<![CDATA[  <xs:element name="Parameters28147"
              type="cpxmlsec:ObjectIdentifierType" />]]>
                    </artwork>
                </figure>

                <figure>
                    <preamble> DTD Definition: </preamble>

                    <artwork>
<![CDATA[  <!ELEMENT Parameters28147 (#PCDATA) >]]>
                    </artwork>
                </figure>

                <figure>
                    <preamble>
                        An example of a GOST&nbsp;28147-89
                        xenc:EncryptionMethod node is:
                    </preamble>

                    <artwork>
<![CDATA[  <xenc:EncryptionMethod dsig:Algorithm=
      "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gost28147">
    <!-- id-Gost28147-89-CryptoPro-A-ParamSet -->
    <cpxmlsec:Parameters28147>urn:oid:1.2.643.2.2.31.1<
    /cpxmlsec:Parameters28147>
  </xenc:EncryptionMethod>]]>
                    </artwork>
                </figure>

                <t>
                    256-bit key, 64-bit Initialization Vector (IV), and optional
                    parameters are used in GOST&nbsp;28147-89 encryption
                    algorithm. The resulting cipher text is prefixed by the IV.
                    If included in XML output, it is then base64 encoded.
                </t>
                
            </section>

            <section title='GOST 28147-89 authenticated encryption in EncryptionMethod'>
            
              <t>
                The identifier for the GOST&nbsp;28147-89 authenticated
                encryption algorithm is:
                <list>
                  <t/>
                  <t>
                    urn:ietf:params:xml:ns:cpxmlsec:algorithms:gost28147aead
                  </t>
                </list>
              </t>
              
              <t>
                The xenc:EncryptionMethod node may contain a child node
                cpxmlsec:Parameters28147 specifying parameters for
                GOST&nbsp;28147-89 algorithm.
              </t>
              
              <t>
                If the application omits cpxmlsec:Parameters28147 node, it
                SHOULD use parameters defined by
                id-tc26-gost-28147-param-Z.
              </t>
              
              <figure>
                <preamble>
                  An example of a GOST&nbsp;28147-89 AEAD
                  xenc:EncryptionMethod node is:
                </preamble>
                
                <artwork>
<![CDATA[  <xenc:EncryptionMethod dsig:Algorithm=
      "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gost28147aead">
    <!-- id-tc26-gost-28147-param-Z -->
    <cpxmlsec:Parameters28147>urn:oid:1.2.643.7.1.2.5.1.1<
    /cpxmlsec:Parameters28147>
  </xenc:EncryptionMethod>]]>
                </artwork>
              </figure>
              
              <t>
                256-bit key, 64-bit Initialization Vector (IV), and optional
                parameters are used in GOST&nbsp;28147-89 authenticated encryption
                algorithm. The resulting cipher text is prefixed by the IV 
                and suffixed by the MAC. Standard XML encryption padding, 
                id-Gost28147-89-CryptoPro-KeyMeshing, imitovstavka and 
                CNT mode should be used during encryption.
                If included in XML output, it is then base64 encoded.
              </t>
              
            </section>
          
            <section title='Symmetric Key Wrap'>

                <t>
                    Symmetric Key Wrap algorithms considered in this section 
                    are shared secret key encryption algorithms that MUST be
                    used for symmetric keys encryption/decryption only.
                </t>

                <section title='GOST 28147-89 Key Wrap in EncryptionMethod'
                         anchor='GOST28147KeyWrap'>

                    <t>
                        The GOST&nbsp;28147-89 Key Wrap algorithm wraps (encrypts) a
                        key (the wrapped key, WK) under a GOST&nbsp;28147-89 Key Wrap
                        (specified in sections 6.1, 6.2 of <xref target='CPALGS'/>).
                    </t>

                    <t>
                        Note: This algorithm MUST NOT be used without key
                        agreement algorithm, because such WK is constant for
                        every wrapping-encrypting pair. Encrypting many
                        different keys with the same constant WK may reveal that WK.
                        The only key agreement algorithm possible to use with
                        GOST&nbsp;28147-89 Key Wrap defined by this specification is
                        a GOST&nbsp;R&nbsp;34.10-2001-based key agreement
                        (see <xref target='GOST3410Agree'/>).
                    </t>

                    <t>
                        The identifier for the GOST&nbsp;28147-89 Key Wrap algorithm is:
                        <list>
                            <t/>
                            <t>
                                urn:ietf:params:xml:ns:cpxmlsec:algorithms:kw-gost
                            </t>
                        </list>
                    </t>

                    <t>
                        The CipherValue for such wrapped key is the base64
                        encoding of the <xref target='X.208-88'/> DER
                        encoding of a GostR3410-KeyWrap structure.
                    </t>

                    <figure>
                        <preamble> ASN.1 structure: </preamble>

                        <artwork>
<![CDATA[  GostR3410-KeyWrap ::=
      SEQUENCE {
          encryptedKey Gost28147-89-EncryptedKey,
          encryptedParameters Gost28147-89-KeyWrapParameters
       }]]>
                        </artwork>
                    </figure>

                    <figure>
                        <preamble>
                            An example of a GOST&nbsp;28147-89 Key Wrap
                            EncryptedData node is:
                        </preamble>

                        <artwork>
<![CDATA[  <xenc:EncryptedData>
    <xenc:EncryptionMethod dsig:Algorithm=
      "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gost28147" />
    <dsig:KeyInfo>
      <xenc:EncryptedKey>
        <xenc:EncryptionMethod xenc:Algorithm=
    "urn:ietf:params:xml:ns:cpxmlsec:algorithms:kw-gost" />
          <dsig:KeyInfo>
            <xenc:AgreementMethod xenc:Algorithm=
    "urn:ietf:params:xml:ns:cpxmlsec:algorithms:agree-gost2001">
              <xenc:KA-Nonce>...</xenc:KA-Nonce>
              <xenc:OriginatorKeyInfo>
                <dsig:X509Data><dsig:X509Certificate>
                  ...
                </dsig:X509Certificate></dsig:X509Data>
              </xenc:OriginatorKeyInfo>
              <xenc:RecipientKeyInfo><dsig:KeyValue>
                ...
              </dsig:KeyValue></xenc:RecipientKeyInfo>
            </xenc:AgreementMethod>          
          </dsig:KeyInfo>
        <xenc:CipherData>
            <xenc:CipherValue>...</xenc:CipherValue>
        </xenc:CipherData>
      </xenc:EncryptedKey>
    </dsig:KeyInfo>
    <xenc:CipherData>
        <xenc:CipherValue>...</xenc:CipherValue>
    </xenc:CipherData>
  </xend:EncryptedData>]]>
                        </artwork>
                    </figure>

                    <t>
                        Gost28147-89-KeyWrapParameters is described in
                        section 4.1.1 of <xref target='CPCMS'/>.
                        The xenc:KA-Nonce node value of the
                        xenc:AgreementMethod node MUST be used as ukm.
                    </t>

                    <t>
                        The resulting wrapped key (WK) is placed in the
                        Gost28147-89-EncryptedKey encryptedKey field, its mac
                        (CEK_MAC) is placed in the Gost28147-89-EncryptedKey macKey
                        field. ukm field of Gost28147-89-KeyWrapParameters
                        MUST be absent.
                    </t>

                </section>

                <section title='CryptoPro Key Wrap in EncryptionMethod'>

                    <t>
                        The CryptoPro Key Wrap algorithm wraps (encrypts)
                        a key (wrapped key, WK) under a CryptoPro Key Wrap
                        (specified in sections 6.3, 6.4 of <xref target='CPALGS'/>).
                    </t>

                    <t>
                        The identifier for the CryptoPro Key Wrap algorithms is:
                        <list>
                            <t/>
                            <t>
                                urn:ietf:params:xml:ns:cpxmlsec:algorithms:kw-cp
                            </t>
                        </list>
                    </t>

                    <t>
                        The CipherValue for such wrapped key is the base64
                        encoding of the <xref target='X.208-88'/> DER
                        encoding of a GostR3410-KeyWrap structure
                        (see <xref target='GOST28147KeyWrap'/>).
                    </t>

                    <figure>
                        <preamble>
                            An example of a CryptoPro Key Wrap
                            EncryptedData node is:
                        </preamble>

                        <artwork>
<![CDATA[  <xenc:EncryptedData>
    <xenc:EncryptionMethod dsig:Algorithm=
      "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gost28147" />
    <dsig:KeyInfo>
      <xenc:EncryptedKey>
        <xenc:EncryptionMethod xenc:Algorithm=
    "urn:ietf:params:xml:ns:cpxmlsec:algorithms:kw-cp" />
          <dsig:KeyInfo>
            <dsig:KeyName>John Smith</dsig:KeyName>
          </dsig:KeyInfo>
        <xenc:CipherData>
            <xenc:CipherValue>...</xenc:CipherValue>
        </xenc:CipherData>
      </xenc:EncryptedKey>
    </dsig:KeyInfo>
    <xenc:CipherData>
        <xenc:CipherValue>...</xenc:CipherValue>
    </xenc:CipherData>
  </xend:EncryptedData>]]>
                        </artwork>
                    </figure>

                    <t>
                        The resulting wrapped key (WK) is placed in the
                        Gost28147-89-EncryptedKey encryptedKey field, its mac
                        (CEK_MAC) is placed in the Gost28147-89-EncryptedKey macKey
                        field.
                    </t>

                    <t>
                        If CryptoPro Key Wrap algorithm is combined
                        with Key Agreement Algorithm, the xenc:KA-Nonce node value of
                        the xenc:AgreementMethod node MUST be used as ukm.
                        ukm field of Gost28147-89-KeyWrapParameters
                        type must be absent.
                    </t>

                    <t>
                        Note: The only key agreement algorithm possible to use with
                        CryptoPro Key Wrap defined by this specification is
                        a GOST&nbsp;R&nbsp;34.10-2001-based key agreement
                        (see <xref target='GOST3410Agree'/>).
                    </t>

                    <t>
                        If CryptoPro Key Wrap algorithm is not combined
                        with Key Agreement Algorithm, ukm field of
                        Gost28147-89-KeyWrapParameters type MUST be present.
                    </t>

                </section>
            </section>
        </section>

        <section title='Specifying GOST within WS-*'>

            <t>
                This section specifies the details of how to use GOST
                algorithms with WS-SecureConversation
                <xref target='WS-SECURECONVERSATION'/>,
                WS-SecurityPolicy <xref target='WS-SECURITYPOLICY'/> and
                WS-Trust <xref target='WS-TRUST'/>.
            </t>

            <section title='GOST Algorithm Suite for WS-SecurityPolicy'>

                <t>
                    This specification defines a new possible value for an
                    [Algorithm Suite] property of a Security Binding
                    (see section 6.1 of <xref target='WS-SECURITYPOLICY'/>).
                    The new value is BasicGost.
                </t>

                <t>
                    BasicGost Algorithm Suite defines the following values
                    for operations and properties (without line breaks in URIs):
                    <list>
                        <t>
                            [Sym Sig]
                            <list>
                                <t>
                                    urn:ietf:params:xml:ns:cpxmlsec:algorithms:hmac-gostr3411
                                </t>
                            </list>
                        </t>
                        <t>
                            [Asym Sig]
                            <list>
                                <t>
                                    urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411
                                </t>
                            </list>
                        </t>
                        <t>
                            [Dig]
                            <list>
                                <t>
                                    urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411
                                </t>
                            </list>
                        </t>
                        <t>
                            [Enc]
                            <list>
                                <t>
                                    urn:ietf:params:xml:ns:cpxmlsec:algorithms:gost28147
                                </t>
                            </list>
                        </t>
                        <t>
                            [Sym KW]
                            <list>
                                <t>
                                    urn:ietf:params:xml:ns:cpxmlsec:algorithms:kw-cp
                                </t>
                            </list>
                        </t>
                        <t>
                            [Asym KW]
                            <list>
                                <t>
                                    urn:ietf:params:xml:ns:cpxmlsec:algorithms:transport-gost2001
                                </t>
                            </list>
                        </t>
                        <t>
                            [Comp Key]
                            <list>
                                <t>
                                    urn:ietf:params:xml:ns:cpxmlsec:algorithms:dk-p-gostr3411
                                </t>
                            </list>
                        </t>
                        <t>
                            [Enc KD]
                            <list>
                                <t>
                                    urn:ietf:params:xml:ns:cpxmlsec:algorithms:dk-p-gostr3411
                                </t>
                            </list>
                        </t>
                        <t>
                            [Sig KD]
                            <list>
                                <t>
                                    urn:ietf:params:xml:ns:cpxmlsec:algorithms:dk-p-gostr3411
                                </t>
                            </list>
                        </t>
                        <t>
                            [Min SKL]
                            <list>
                                <t>
                                    256
                                </t>
                            </list>
                        </t>
                        <t>
                            [Max SKL]
                            <list>
                                <t>
                                    256
                                </t>
                            </list>
                        </t>
                        <t>
                            [Min AKL]
                            <list>
                                <t>
                                    512
                                </t>
                            </list>
                        </t>
                        <t>
                            [Max AKL]
                            <list>
                                <t>
                                    512
                                </t>
                            </list>
                        </t>
                    </list>
                </t>

                <t>
                    Note: For definition of [Comp Key], [Enc KD] and [Sig KD]
                    algorithm see <xref target='GOSTKeyDerivation'/>
                </t>
                
                <t>
                    To indicate a requirement to use GOST Algorithm Suite
                    defined above conforming implementations MUST place
                    cpxmlsec:BasicGost node in sp:AlgorithmSuite Assertion
                    (see section 7.1 of <xref target='WS-SECURITYPOLICY'/>).
                </t>

                <figure>
                    <preamble>Schema Definition:</preamble>

                    <artwork>
<![CDATA[  <xs:element name="BasicGost"
              type="sp:QNameAssertionType"/>]]>
                    </artwork>
                </figure>

                <figure>
                    <preamble>DTD Definition:</preamble>

                    <artwork>
<![CDATA[  <!ELEMENT BasicGost EMPTY >]]>
                    </artwork>
                </figure>

                <figure>
                    <preamble>
                        An example of a GOST Algorithm Suite in
                        sp:AlgorithmSuite Assertion is:
                    </preamble>

                    <artwork>
<![CDATA[  <sp:AlgorithmSuite>
    <wsp:Policy>
      <cpxmlsec:BasicGost/>
    </wsp:Policy>
  </sp:AlgorithmSuite>]]>
                    </artwork>
                </figure>

            </section>

            <section title='GOST Key Derivation Algorithm for WS-SecureConversation'
                     anchor='GOSTKeyDerivation'>

                <t>
                    This specification defines a new possible value for an
                    Algorithm attribute of a wsc:DerivedKeyToken node
                    (see section 7 of <xref target='WS-SECURECONVERSATION'/>).
                </t>
                
                <t>
                    The new key derivation algorithm identifier is:
                    <list>
                        <t/>
                        <t>
                            urn:ietf:params:xml:ns:cpxmlsec:algorithms:dk-p-gostr3411
                        </t>
                    </list>
                </t>

                <figure>
                    <preamble>
                        An example of a GOST Key Derivation Algorithm in
                        wsc:DerivedKeyToken node is:
                    </preamble>

                    <artwork>
<![CDATA[  <wsc:DerivedKeyToken Algorithm=
    "urn:ietf:params:xml:ns:cpxmlsec:algorithms:dk-p-gostr3411">
    <wsse:SecurityTokenReference>...</wsse:SecurityTokenReference>
    <wsc:Nonce>...</wsc:Nonce>
  </wsc:DerivedKeyToken>]]>
                    </artwork>
                </figure>

                <t>
                    GOST Key Derivation Algorithm uses a pseudo-random function
                    P_GOSTR3411 (see section 4 of <xref target='CPALGS'/>) to derive
                    keys just like a P_SHA-1 function is used in
                    <xref target='WS-SECURECONVERSATION'/> (see section 7).
                </t>

            </section>

            <section title='GOST Computed Key Mechanism for WS-Trust'>

                <t>
                    This specification defines a new possible value for a
                    wst:ComputedKey node (see section 4.4.4 of
                    <xref target='WS-TRUST'/>).
                </t>

                <t>
                    The new computed key mechanism identifier is:
                    <list>
                        <t/>
                        <t>
                            urn:ietf:params:xml:ns:cpxmlsec:algorithms:ck-p-gostr3411
                        </t>
                    </list>
                </t>

                <figure>
                    <preamble>
                        An example of a GOST Computed Key Mechanism in
                        wst:ComputedKey node (without line breaks) is:
                    </preamble>

                    <artwork>
<![CDATA[  <wst:ComputedKey>
    urn:ietf:params:xml:ns:cpxmlsec:algorithms:ck-p-gostr3411
  </wst:ComputedKey>]]>
                    </artwork>
                </figure>

                <t>
                    GOST Computed Key Mechanism uses a pseudo-random function
                    P_GOSTR3411 (see section 4 of <xref target='CPALGS'/>) to
                    compute a key just like a P_SHA-1 function is used in
                    <xref target='WS-TRUST'/> (see section 4.4.4).
                    It is REQUIRED that EntREQ and EntRES are strings of
                    length 256 bits.
                </t>

            </section>

            <section title='Using WS-Trust for TLS Handshake with GOST Algorithm Suite'>

                <t>
                    This specification defines how to use WS-Trust
                    (<xref target='WS-TRUST'/>) to perform
                    TLS Handshake (see <xref target='TLS'/>) and establish
                    secure session for GOST Algorithm Suite.
                </t>
                
                <t>
                    WS-Trust can be used to do TLS Handshake as specified in
                    <xref target='WS-TRUST-TLS'/>. The outcome of the
                    protocol under discussion is a new session key issued using a
                    secure session established by TLS Handshake. Issued session
                    key is intended to secure further communication by means of
                    WS-Security (<xref target='WS-SECURITY'/>).
                </t>

                <t>
                    If application is required to use GOST Algorithm Suite after
                    performing TLS Handshake by WS-Trust it MUST use one of
                    GOST&nbsp;28147-89 Cipher Suites for TLS
                    (see <xref target='draft.CPTLS'/>).
                </t>

                <t>
                    The main flow of TLS Negotiation over WS-Trust defined in
                    this specification complies with
                    <xref target='WS-TRUST-TLS'/>, but there are a few
                    differences specified below that MUST be obeyed.
                </t>

                <t>
                    The paragraph R4305 (see section 4.3 of
                    <xref target='WS-TRUST-TLS'/>) MUST be replaced with the
                    following text:

                    <list>
                        <t>
                            The responder is responsible for issuing the key
                            associated with the TLSNego session. If the
                            initiator requested properties for the generated
                            key (e.g. key size) in the initial RST message,
                            the generated key SHOULD match those requirements.
                            The issued key MUST be communicated back to the
                            initiator using the wst:RequestedProofToken element
                            and MUST be protected using CryptoPro Key Wrap
                            algorithm (see section 6.3
                            of <xref target='CPALGS'/>)
                            where server_write_key (see section 6.3
                            of <xref target='TLS'/>) is a wrapping key.
                            Wrapped key is contained in the
                            <![CDATA[<xenc:CipherData><xenc:CipherValue>...</xenc:CipherValue></xenc:CipherData>]]>
                            elements of the xenc:EncryptedKey.
                        </t>
                    </list>
                </t>

                <t>
                    GOST&nbsp;R&nbsp;34.11-94 and P_GOSTR3411 algorithms
                    MUST be used instead of SHA1 and PSHA1 algorithms
                    correspondingly to compute authenticator
                    (see section 4.9 of
                    <xref target='WS-TRUST-TLS'/>).
                </t>

            </section>

        </section>

        <section title='Security Considerations'>

            <t>
                Conforming applications MUST use unique values for ukm and iv.
                Recipients MAY verify that ukm and iv specified by the sender are
                unique.
            </t>

            <t>
                Applications SHOULD verify signature values, subject public
                keys and algorithm parameters to conform to
                <xref target='GOSTR341001'/>, standard before using them.
            </t>

            <t>
                Cryptographic algorithm parameters affect algorithm strength.
                Using parameters not listed in <xref target='CPALGS'/> is NOT
                RECOMMENDED (see the Security Considerations section of
                <xref target='CPALGS'/>).
            </t>

            <t>
                Using the same key for signature and key derivation is NOT
                RECOMMENDED.
            </t>

            <t>
                It is NOT RECOMMENDED to use XML encryption without XML
                signature or HMAC.
            </t>

        </section>

        <section title='IANA Considerations'>

            <t>
                This document uses URNs to describe XML namespaces and XML schemata
                conforming to a registry mechanism described in
                <xref target='RFC3688'/>.  IANA has registered two URI assignments.
            </t>

            <section title='URN Sub-Namespace Registration for urn:ietf:params:xml:ns:cpxmlsec'>

                <t>
                    URI: urn:ietf:params:xml:ns:cpxmlsec
                </t>

                <t>
                    Registrant Contact:
                    <list>
                        <t>
                            Mikhail V. Pavlov
                        </t>
                        <t>
                            CRYPTO-PRO, Ltd.
                        </t>
                        <t>
                            16/5, Suschevskij val
                        </t>
                        <t>
                            Moscow, 127018
                        </t>
                        <t>
                            Russia
                        </t>
                        <t>
                            Phone: +7 (495) 780 4820
                        </t>
                        <t>
                            Fax: +7 (495) 660 2330
                        </t>
                        <t>
                            Email: pav@CryptoPro.ru
                        </t>
                        <t>
                            URI: http://www.CryptoPro.ru
                        </t>
                    </list>
                </t>

                <t>
                    XML: None. Namespace URIs do not represent an XML specification.
                </t>

            </section>

            <section title='Schema Registration'>

                <t>
                    URI: urn:ietf:params:xml:schema:cpxmlsec
                </t>

                <t>
                    Registrant Contact:
                    <list>
                        <t>
                            Mikhail V. Pavlov
                        </t>
                        <t>
                            CRYPTO-PRO, Ltd.
                        </t>
                        <t>
                            16/5, Suschevskij val
                        </t>
                        <t>
                            Moscow, 127018
                        </t>
                        <t>
                            Russia
                        </t>
                        <t>
                            Phone: +7 (495) 780 4820
                        </t>
                        <t>
                            Fax: +7 (495) 660 2330
                        </t>
                        <t>
                            Email: pav@CryptoPro.ru
                        </t>
                        <t>
                            URI: http://www.CryptoPro.ru
                        </t>
                    </list>
                </t>

                <t>
                    XML: The XML can be found in <xref target='SCHEMA' />.
                </t>

            </section>
        </section>
    </middle>

    <back>
        <references title='Normative references'>
            &xml-schema-1;
            &xml-schema-2;
            &xml-ns;
            &rfc3986;
            &rfc4648;
            &rfc3688;
            &hmac;
            &keywords;
            &xmlenc-core;
            &xmldsig;
            &cpalgs;
            &cppk;
            &cpcms;
            &gost28147;
            &gostr341001;
            &gostr341194;
            &gost3431004;
            &gost3431195;
            &ws-security;
            &ws-secureconversation;
            &ws-securitypolicy;
            &ws-policy;
            &ws-trust;
            &ws-trust-tls;
            &tls;
            &cptls;
            &asn1;
        </references>

        <references title='Informative references'>
            &xml-core;
            &urnoid;
            &rfc4134;
        </references>

        <section title='Aggregate XML Schema'
                 anchor='SCHEMA'>
            <t>
                <?rfc include='cpxmldsig.xsd' ?>
            </t>
        </section>

        <section title='Aggregate DTD'>

            <t>
                <?rfc include='cpxmldsig.dtd' ?>
            </t>

        </section>

        <section title='Examples'>

            <t>
                Examples here are stored in the same format as the examples in
                <xref target='RFC4134'/> and can be extracted using the same
                program.
            </t>

            <t>
                If you want to extract without the program, copy all the lines
                between the "|&gt;" and "|&lt;" markers, remove any page breaks,
                and remove
                the "|" in the first column of each line.  The result is a valid
                Base64 blob that can be processed by any Base64 decoder.
            </t>

            <section title='Signed document'>

                <t>
                    This sample contain the signed XML document using the sample
                    certificate from Section 4.2 of <xref target='CPPK'/>.
                </t>

                <t>
                    <?rfc include='XmlDocSigned2001.b64' ?>
                </t>

            </section>
        </section>

        <section title='Acknowledgments'>

            <t>The authors wish to thank:</t>

            <t>
                <list>
                    <t>
                        Microsoft Corporation Russia for provided
                        information about company products and solutions,
                        and also for technical consulting in PKI.
                    </t>
                    <t/>
                    <t>
                        Our colleague Grigorij S. Chudov for writing the first
                        version of this document.
                    </t>
                </list>
            </t>
        </section>

    </back>

</rfc>
