private bool validateKey(string Key, string clave)
        {
            Chilkat.PrivateKey obj = new Chilkat.PrivateKey();
            bool respuesta         = obj.LoadPkcs8EncryptedFile(Key, clave);

            return(respuesta);
        }
Пример #2
0
        public static byte[] HashAndSignBytes(byte[] DataToSign, string user)
        {
            try
            {
                // Create a new instance of RSACryptoServiceProvider using the
                // key from RSAParameters.
                RSACryptoServiceProvider RSAalg = new RSACryptoServiceProvider();

                Chilkat.PrivateKey pkey = new Chilkat.PrivateKey();

                // Load the private key from an RSA PEM file:
                bool   success = pkey.LoadPemFile("C:\\Users\\Lenovo\\Desktop\\Detyra1_DS-Gr-6-master\\ds\\bin\\Debug\\netcoreapp3.0\\keys\\" + user + ".pem");
                string pkeyXml;
                // Get the private key in XML format:
                pkeyXml = pkey.GetXml();
                RSAalg.FromXmlString(pkeyXml);

                // Hash and sign the data. Pass a new instance of SHA1CryptoServiceProvider
                // to specify the use of SHA1 for hashing.
                return(RSAalg.SignData(DataToSign, new SHA1CryptoServiceProvider()));
            }
            catch (CryptographicException e)
            {
                Console.WriteLine(e.Message);

                return(null);
            }
        }
Пример #3
0
        static void testdecrypt()
        {
            //byte[] encryptedArr = {145, 110, 51, 179, 147, 38, 228, 145, 55, 179, 143, 45, 179, 239, 28, 251, 127, 202, 47, 73, 49, 31, 36, 232, 81, 219, 2, 180, 16, 104, 203, 148, 207, 36, 110, 184, 225, 133, 190, 185, 22, 75, 49, 69, 129, 101, 161, 215, 102, 66, 218, 127, 193, 201, 222, 181, 187, 251, 221, 205, 103, 188, 5, 77, 94, 236, 43, 121, 182, 233, 109, 123, 64, 93, 61, 61, 204, 157, 23, 17, 220, 187, 150, 187, 29, 230, 91, 89, 241, 27, 34, 18, 21, 195, 220, 231, 237, 47, 123, 247, 128, 107, 169, 115, 84, 103, 129, 126, 99, 231, 2, 23, 152, 183, 136, 70, 64, 116, 125, 198, 240, 128, 129, 133, 5, 144, 179, 255, 10, 14, 148, 216, 164, 78, 253, 190, 231, 153, 157, 64, 212, 78, 212, 191, 230, 120, 58, 223, 147, 241, 222, 191, 22, 99, 80, 126, 212, 172, 14, 43, 135, 43, 117, 47, 172, 161, 38, 67, 125, 205, 186, 91, 35, 89, 110, 243, 184, 200, 158, 220, 161, 222, 172, 53, 211, 90, 55, 126, 190, 183, 71, 101, 215, 218, 90, 68, 122, 226, 237, 119, 139, 176, 51, 129, 7, 71, 154, 196, 52, 16, 136, 104, 4, 108, 136, 112, 25, 45, 88, 232, 94, 159, 199, 221, 152, 88, 156, 73, 183, 158, 241, 10, 102, 50, 166, 183, 86, 252, 102, 4, 190, 144, 149, 136, 255, 115, 163, 177, 88, 67, 88, 85, 247, 0, 30, 159};

            string encryptedStr = "";

            encryptedStr = "YrOiK4Efq2oM4Ny0YW7VFnOtkWHpcFg1zHHfxpdEX1k/wbjbMHyBYn6Uo1qB6fcRNmokO1L48fQGfpeyErgWSt/D1pBlffV+QkGNLtApXIShPdOj8uqElP0T8skNTZCUNqsaB5MPwFsUDiuynimqikM6tBNdLss+z81LbxARUlao/yN112GoxQQ4wpnaDk/eOA51J+5aZb2jMssHwAFx3M3K8AJmUv4qBN8lOAnahd3QnDgaxk7gNydjKyVi1eRGHYxwQVNwMsV1we7EFDMBICG97i4GmWrP2BkrXs8J09osP2O++TIVZrxYpEGwwrRmtno1bBCfySWLNuxd33jwcg==";
            encryptedStr = "SnGp1BBb0fU7poFpM5Z0oD0YtfYZizU97GxUF9pn58yGEhpTdJ2vWy/NrhYMPflf4yym77zUyNVhDaOZ+1Q2H4imkiXa5q9DsBRN+dl5dVvosEse3OSyOTEbxn4AcrreWGhKTJ+/3mEhRotUE/rUuWskXKzSA+WQ0nSGUxSG/Rw0yaCeWsa1MU3UM0ugxxxd2gExY+K39+4nXUzNMv+H4XniTvmmUI7k8TEGAsZujwDsU9Oh+MbMtH8nlTu+yvfS++/dDTX9bFmpbkkH7FgbVvKcoICXsI5UfTATfRL4LkzdipO8VJNiPKT8TkgZyIJC/m1daLGAmIs+fM98rWm9yg==";
            //DECRYPT
            Chilkat.PrivateKey privkey1 = new Chilkat.PrivateKey();
            bool success = privkey1.LoadPem(mykey);

            Chilkat.Rsa rsa4 = new Chilkat.Rsa();
            success = rsa4.UnlockComponent("HAFSJORSA_K36nxU3n1Yui");

            rsa4.EncodingMode = "base64";
            rsa4.Charset      = "ANSI";
            rsa4.LittleEndian = true;
            rsa4.OaepPadding  = false;
            success           = rsa4.ImportPrivateKey(privkey1.GetXml());
            bool usePrivateKey = true;

            //byte[] decryptedArr = rsa4.DecryptBytes(encryptedArr, usePrivateKey);
            string decryptedStr = rsa4.DecryptStringENC(encryptedStr, usePrivateKey);
        }
Пример #4
0
        public void SignRequest(ref HttpWebRequest Request)
        {
            TimeSpan diff      = DateTime.UtcNow - (new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc));
            uint     timestamp = (uint)Math.Floor(diff.TotalSeconds); // Seconds since 1970
            string   data      = timestamp.ToString();

            Chilkat.PrivateKey privkey1 = new Chilkat.PrivateKey();
            privkey1.LoadPem(mykey);
            Chilkat.Rsa rsa1    = new Chilkat.Rsa();
            bool        success = rsa1.UnlockComponent("HAFSJORSA_K36nxU3n1Yui");

            success           = rsa1.ImportPrivateKey(privkey1.GetXml());
            rsa1.EncodingMode = "base64";
            rsa1.Charset      = "ANSI";
            rsa1.LittleEndian = false;
            rsa1.OaepPadding  = false;

            string s_mysecre = data + mysecret;

            char[] c_mysecre = s_mysecre.ToCharArray();
            byte[] b_mysecre = System.Text.Encoding.GetEncoding("windows-1252").GetBytes(c_mysecre);
            string hexSig    = rsa1.SignBytesENC(b_mysecre, "sha-1");

            Request.Headers.Add("timestamp", data);
            Request.Headers.Add("signed", hexSig);
        }
Пример #5
0
        static void RSAChilat(string Data)
        {
            Chilkat.PrivateKey l_key = new Chilkat.PrivateKey();
            bool   l_res             = l_key.LoadPemFile(@"D:\Work\Other\ForexStars\_incomming\project1074.ppk");
            string l_pr_key_xml      = l_key.GetXml();


            Chilkat.Rsa rsa = new Chilkat.Rsa();
            rsa.ImportPrivateKey(l_pr_key_xml);
            //rsa.UnlockComponent("30-day trial");
            rsa.UnlockComponent("RSA$TEAM$BEAN_495C86FD5RkU");
            rsa.EncodingMode = "hex";
            rsa.LittleEndian = false;
            string l_sign = rsa.SignStringENC(Data, "sha-1");
        }
Пример #6
0
        static string HttpGet(string url)
        {
            bool           success = false;
            HttpWebRequest req     = WebRequest.Create(url) as HttpWebRequest;

            string Token = String.Format("{0:yyyy-MM-dd HH:mm:ss}", new DateTime(2010, 02, 02, 21, 15, 0));

            //SIGN
            Chilkat.PrivateKey privkey1 = new Chilkat.PrivateKey();
            privkey1.LoadPem(mykey);
            Chilkat.Rsa rsa1 = new Chilkat.Rsa();
            success           = rsa1.UnlockComponent("HAFSJORSA_K36nxU3n1Yui");
            success           = rsa1.ImportPrivateKey(privkey1.GetXml());
            rsa1.EncodingMode = "base64";
            rsa1.Charset      = "ANSI";
            rsa1.LittleEndian = false;
            rsa1.OaepPadding  = false;
            string hexSig = rsa1.SignStringENC(Token, "sha-1");


            //VERIFY
            Chilkat.Cert cert2 = new Chilkat.Cert();
            success = cert2.LoadFromBase64(mycert);
            Chilkat.PublicKey pubKey2 = null;
            pubKey2 = cert2.ExportPublicKey();
            Chilkat.Rsa rsa2 = new Chilkat.Rsa();
            success           = rsa2.ImportPublicKey(pubKey2.GetXml());
            rsa2.EncodingMode = "base64";
            rsa2.Charset      = "ANSI";
            rsa2.LittleEndian = false;
            rsa2.OaepPadding  = false;
            success           = rsa2.VerifyStringENC(Token, "sha-1", hexSig);

            req.Headers.Add("Token", Token);
            req.Headers.Add("Signature", hexSig);

            //ENCRYPT
            Chilkat.Cert cert3 = new Chilkat.Cert();
            success = cert3.LoadFromBase64(mycert);
            Chilkat.PublicKey pubKey3 = null;
            pubKey3 = cert3.ExportPublicKey();
            Chilkat.Rsa rsa3 = new Chilkat.Rsa();
            success           = rsa3.UnlockComponent("HAFSJORSA_K36nxU3n1Yui");
            rsa3.EncodingMode = "base64";
            rsa3.Charset      = "ANSI";
            rsa3.LittleEndian = true;
            rsa3.OaepPadding  = false;
            rsa3.ImportPublicKey(pubKey3.GetXml());
            bool usePrivateKey = false;

            System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
            byte[] TokenArr = encoding.GetBytes(Token);
            //byte[] encryptedArr = rsa3.EncryptBytes(TokenArr, usePrivateKey);
            string encryptedstr = rsa3.EncryptBytesENC(TokenArr, usePrivateKey);

            //DECRYPT
            Chilkat.Rsa rsa4 = new Chilkat.Rsa();
            rsa4.EncodingMode = "base64";
            rsa4.Charset      = "ANSI";
            rsa4.LittleEndian = true;
            rsa4.OaepPadding  = false;
            rsa4.ImportPrivateKey(privkey1.GetXml());
            usePrivateKey = true;
            //encryptedStr = "XJ65xTR/xvD2N9xBKyKPqPijqTAyJuVtOlbaFUIboJaEPHH9pv+Lhrd5o6MSwKF6TeXs6hVsKnj8jVeYFYoEDgJS95GqaaUomWBhEZYchOp/6dn3ZxCeQoljAWLt6m4C829R9b5JYatYar9YV0d+QV+jVWE4U0rlNrkTqtA02Qw4ztN4/oehgCISrBnc81N1MYNwG9vrTHSVM6tSUWjWxMRubpOBvqKqOxyA9fpJNHgUyzio2X1cp12K++1GEUWNWyYVhTiBr/QM3mUN67mHcn0vvWZvmPhYlIaVn9DqIvVdMbHRbLwrCczFgY4PdHrhcH9yDTlkkAbKUatgDQiI4w==";
            //encryptedStr = "6KQbxh+x5SGIzD89zEwj+/IVVCBocemCXWl1mr+mk9wxRMydCfmMSUHDOafnqiJ6GAJapKbLTHOc9d1OyWTwsp5BQBT5VM20hb9r+AkDrHwkgL06ifizP0gTEO17cyO95jwlRXOfkQKb3cERLBEtOAnRep4bKMSsPLyxRRBX5VT4d19yxRor2V9js0CEFONinxl7qRxjckwvQk53+qpxeQ8jOx+pmrQukX7nWkMajWi+ZFndyfLL3LfRBYZKN2R0vdrnSMKdkxUEUUJybsv4QCMWshNpQznPSantq2dKNe07eB5mX4fRufy4mY4qjqBlf8+XFKdD+J37C6r3THL6pw==";
            //string decryptedStr = rsa4.DecryptStringENC(encryptedStr, usePrivateKey);



            Chilkat.Crypt2 crypt = new Chilkat.Crypt2();
            success              = crypt.UnlockComponent("HAFSJOCrypt_0xo09cJWVQAw");
            crypt.EncodingMode   = "base64";
            crypt.CryptAlgorithm = "none";
            req.Headers.Add("authorization", "Basic " + crypt.EncryptStringENC("Mogens:Hafsjold"));

            string result = null;

            using (HttpWebResponse resp = req.GetResponse() as HttpWebResponse)
            {
                StreamReader reader = new StreamReader(resp.GetResponseStream());
                result = reader.ReadToEnd();
            }
            return(result);
        }
Пример #7
0
        public static void ECC_SHared_secret()
        {
            bool success;

            //  -----------------------------------------------------------------
            //  (Client-Side) Generate an ECC key, save the public part to a file.
            //  -----------------------------------------------------------------
            Chilkat.Prng       prngClient    = new Chilkat.Prng();
            Chilkat.Ecc        eccClient     = new Chilkat.Ecc();
            Chilkat.PrivateKey privKeyClient = eccClient.GenEccKey("secp256r1", prngClient);
            if (eccClient.LastMethodSuccess != true)
            {
                Console.WriteLine(eccClient.LastErrorText);
                return;
            }

            Chilkat.PublicKey pubKeyClient = privKeyClient.GetPublicKey();
            pubKeyClient.SavePemFile(false, "qa_output/eccClientPub.pem");

            //  -----------------------------------------------------------------
            //  (Server-Side) Generate an ECC key, save the public part to a file.
            //  -----------------------------------------------------------------
            Chilkat.Prng       prngServer    = new Chilkat.Prng();
            Chilkat.Ecc        eccServer     = new Chilkat.Ecc();
            Chilkat.PrivateKey privKeyServer = eccServer.GenEccKey("secp256r1", prngServer);
            if (eccServer.LastMethodSuccess != true)
            {
                Console.WriteLine(eccServer.LastErrorText);
                return;
            }

            Chilkat.PublicKey pubKeyServer = privKeyServer.GetPublicKey();
            pubKeyServer.SavePemFile(false, "qa_output/eccServerPub.pem");

            //  -----------------------------------------------------------------
            //  (Client-Side) Generate the shared secret using our private key, and the other's public key.
            //  -----------------------------------------------------------------

            //  Imagine that the server sent the public key PEM to the client.
            //  (This is simulated by loading the server's public key from the file.
            Chilkat.PublicKey pubKeyFromServer = new Chilkat.PublicKey();
            pubKeyFromServer.LoadFromFile("qa_output/eccServerPub.pem");
            string sharedSecret1 = eccClient.SharedSecretENC(privKeyClient, pubKeyFromServer, "base64");

            //  -----------------------------------------------------------------
            //  (Server-Side) Generate the shared secret using our private key, and the other's public key.
            //  -----------------------------------------------------------------

            //  Imagine that the client sent the public key PEM to the server.
            //  (This is simulated by loading the client's public key from the file.
            Chilkat.PublicKey pubKeyFromClient = new Chilkat.PublicKey();
            pubKeyFromClient.LoadFromFile("qa_output/eccClientPub.pem");
            string sharedSecret2 = eccServer.SharedSecretENC(privKeyServer, pubKeyFromClient, "base64");

            //  ---------------------------------------------------------
            //  Examine the shared secrets.  They should be the same.
            //  Both sides now have a secret that only they know.
            //  ---------------------------------------------------------
            Console.WriteLine(sharedSecret1);
            Console.WriteLine(sharedSecret2);
        }
Пример #8
0
        public static void Sign()
        {
            //  This example requires the Chilkat API to have been previously unlocked.
            //  See Global Unlock Sample for sample code.

            //  The SOAP XML to be signed in this example contains the following:

            //  <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
            //  <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
            //      <SOAP-ENV:Header>
            //          <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" SOAP-ENV:mustUnderstand="1"></wsse:Security>
            //      </SOAP-ENV:Header>
            //      <SOAP-ENV:Body xmlns:SOAP-SEC="http://schemas.xmlsoap.org/soap/security/2000-12" SOAP-SEC:id="Body">
            //          <z:FooBar xmlns:z="http://example.com" />
            //      </SOAP-ENV:Body>
            //  </SOAP-ENV:Envelope>
            //

            //  The above XML is available at https://www.chilkatsoft.com/exampleData/soapToSign.xml
            //  Fetch the XML and then sign it..

            string url = "https://www.chilkatsoft.com/exampleData/soapToSign.xml";

            Chilkat.Http          http      = new Chilkat.Http();
            Chilkat.StringBuilder sbSoapXml = new Chilkat.StringBuilder();
            bool success = http.QuickGetSb(url, sbSoapXml); //Not Working

            if (success != true)
            {
                Debug.WriteLine(http.LastErrorText);
                return;
            }

            //  Load a PFX file containing the certificate + private key.
            Chilkat.Cert cert = new Chilkat.Cert();
            success = cert.LoadPfxFile("E:\\XML\\keystore-demo\\certificate-sha256.pfx", "1234567890");
            if (success != true)
            {
                Debug.WriteLine(cert.LastErrorText);
                return;
            }

            //  Get the RSA private key for signing...
            Chilkat.PrivateKey rsaKey = cert.ExportPrivateKey();
            if (cert.LastMethodSuccess != true)
            {
                Debug.WriteLine(cert.LastErrorText);
                return;
            }

            //  To create the XML digital signature (i.e. embed the signature within
            //  the SOAP XML), we specify what is desired, and then call the method to
            //  create the XML signature.
            //
            //  For example, the application must provide the following:
            //      - Where to put the signature.
            //      - What to sign.
            //      - The algorithms to be used.
            //      - The key to be used for signing.
            //

            Chilkat.XmlDSigGen xmlSigGen = new Chilkat.XmlDSigGen();

            //  In this example, we're going to put the signature within the wsse:Security element.
            //  To specify the location, set the SigLocation property to the XML path to this element,
            //  using vertical bar characters to separate tags.
            xmlSigGen.SigLocation = "SOAP-ENV:Envelope|SOAP-ENV:Header|wsse:Security";

            //  An XML digital signature contains one or more references.  These are references to the parts
            //  of the XML document to be signed (a same document reference), or can be external references.
            //  This example will add a single same-document reference.  We'll add a reference to the XML fragment
            //  at SOAP-ENV:Body, which is indicated by providing the value of the "ID" attribute (where "ID" is case
            //  insensitive).  For each same-document reference, we must also indicate the hash algorithm and XML canonicalization
            //  algorithm to be used.  For this example we'll choose SHA-256 and Exclusive XML Canonicalization.
            xmlSigGen.AddSameDocRef("Body", "sha256", "EXCL_C14N", "", "");

            //  Let's provide the RSA key to be used for signing:
            xmlSigGen.SetPrivateKey(rsaKey);

            //  We're leaving the following properties at their default values:
            //
            //     - SigNamespacePrefix (default is "ds")
            //     - SigningAlg (for RSA keys. The default is PKCS1-v1_5, can be changed to RSASSA-PSS.)
            //     - SignedInfoCanonAlg  (default is EXCL_C14N)
            //     - SignedInfoDigestMethod (default is sha256)
            //     - KeyInfoType (default is "KeyValue", where the RSA public key is included in the Signature)

            //  Note: Each Reference has it's own specified algorithms for XML canonicalization and hashing,
            //  and the actual signature part (the SignedInfo) has it's own algorithms for the same.
            //  They may or may not be the same.  In this example, we use Exclusive XML Canonicalization and SHA-256 throughout.

            //  Finally, we're going to set one property that's optional, but commonly used.
            //  It's the SignedInfoPrefixList.  In this case, we're using Exclusive Canonicalization, and the signature
            //  will be placed in a location within the XML document where namespace prefixes are used in the ancestors.
            //  Specifically, the "wsse" and "SOAP-ENV" namespace prefixes are used.
            xmlSigGen.SignedInfoPrefixList = "wsse SOAP-ENV";

            //  OK, everything's specified, so let's create the XML digital signature:
            //  This in-place signs the XML.  If successful, sbSoapXml will contain the
            //  XML with the digital signature at the specified location.
            success = xmlSigGen.CreateXmlDSigSb(sbSoapXml);
            if (success != true)
            {
                Debug.WriteLine(xmlSigGen.LastErrorText);
                return;
            }

            //  Examine the signed SOAP XML:
            Debug.WriteLine(sbSoapXml.GetAsString());

            //  This is the signed SOAP XML.
            //  Chilkat emits the Signature in compact form on a single line.  Whitespace in XML signatures
            //  matters.  Chilkat's opinion is that writing the Signature without whitespace minimizes the chance
            //  for problems with whatever software might be verifying the signature.

            //  <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
            //  <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
            //      <SOAP-ENV:Header>
            //          <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" SOAP-ENV:mustUnderstand="1"><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><InclusiveNamespaces xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="wsse SOAP-ENV"/></ds:CanonicalizationMethod><ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/><ds:Reference URI="#Body"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>OwgHPZNfDkXnZsjpfzXqAcT3RV3HzmTsEy2bP44FJ0M=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>C+7FWngUpJ33Q1yq8uuscjCyPN2IO4cJhpMv03Jrrht1V+4gvJQLIBk6HHjo1uPQyfYj6zji3pg+fOyGUptp17CsRvjCzSpP35vB2lEzHeS8dcY8XfrEtTP/0FNn75LmhhkOPy0wjWkgDVbgzhXpEk9az8r8fQVTM3vrcmXT+WdMWJXKBRFt6PLAhsFt0scOFTWAkLGyCwygzimDKX2nT63TOit9BigtIx7fPRuMkbybMKCGGABq2DiEbvrPOiN3SUYpyMNR9KehRAGN+OWnESaDC6DhOvbKR88XHkM+GeaRe9PWdrRHrwGfp3qgolKjR/wFRSa1YGSBKAhDJFBcdg==</ds:SignatureValue><ds:KeyInfo><ds:KeyValue><ds:RSAKeyValue><ds:Modulus>sXeRhM55P13FbpNcXAMR3olbw2Wa6keZIHu5YTZYUBTlYWId+pNiwUz3zFIEo+0IfYR0H27ybIycQO+1IIzJofUFNMAL3tZps2OKPlsjuCPls6kXpXhv/gvhux8LrCtp4PcKWqJ6QVOZKChc7WAx40qFWzHi57ueqRTv3x0kESqGg/VjsqyTEvb55psJO2RsfhLT7+YVh3hImRM3RDaJdkTkPuOxeFyT6N7VXD09329sLuS3QkUbE9zEKDnz9X3d8dEQdJhSI9ba5fxl8R7fu8pB67ElfzFml96X1jLFtzy1pzOT5Fc4ROcaqlYckVzdBq9sxezm6MYmDBjNAcibRw==</ds:Modulus><ds:Exponent>AQAB</ds:Exponent></ds:RSAKeyValue></ds:KeyValue></ds:KeyInfo></ds:Signature></wsse:Security>
            //      </SOAP-ENV:Header>
            //      <SOAP-ENV:Body xmlns:SOAP-SEC="http://schemas.xmlsoap.org/soap/security/2000-12" SOAP-SEC:id="Body">
            //          <z:FooBar xmlns:z="http://example.com" />
            //      </SOAP-ENV:Body>
            //  </SOAP-ENV:Envelope>

            //  Here's the signature part formatted for easier reading.
            //  (Adding whitespace to the SignedInfo breaks the signature, so you wouldn't want to do this..)

            //      <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
            //          <ds:SignedInfo>
            //              <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
            //                  <InclusiveNamespaces xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="wsse SOAP-ENV" />
            //              </ds:CanonicalizationMethod>
            //              <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" />
            //              <ds:Reference URI="#Body">
            //                  <ds:Transforms>
            //                      <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
            //                  </ds:Transforms>
            //                  <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
            //                  <ds:DigestValue>OwgHPZNfDkXnZsjpfzXqAcT3RV3HzmTsEy2bP44FJ0M=</ds:DigestValue>
            //              </ds:Reference>
            //          </ds:SignedInfo>
            //          <ds:SignatureValue>C+7FWngUp....BKAhDJFBcdg==</ds:SignatureValue>
            //          <ds:KeyInfo>
            //              <ds:KeyValue>
            //                  <ds:RSAKeyValue>
            //                      <ds:Modulus>sXeRhM55P13FbpNcXAMR....MYmDBjNAcibRw==</ds:Modulus>
            //                      <ds:Exponent>AQAB</ds:Exponent>
            //                  </ds:RSAKeyValue>
            //              </ds:KeyValue>
            //          </ds:KeyInfo>
            //      </ds:Signature>
        }