Finally, we're going to set one property that's optional, but commonly used. In this example, we use Exclusive XML Canonicalization and SHA-256 throughout. The SignedInfo part also has specified hash and canonicalization algorithms, which may be different // than the algorithms used in the References. We're leaving the following properties at their default values: // // - SigNamespacePrefix (default is "ds") // - SignedInfoCanonAlg (default is EXCL_C14N) // - SignedInfoDigestMethod (default is sha256) // - KeyInfoType (default is "KeyValue", where the ECDSA public key is included in the Signature) // Note: Each Reference specifies its own algorithms for XML canonicalization and hashing. Let's provide the ECDSA key to be used for signing: For this example we'll choose SHA-256 and Exclusive XML Canonicalization. For each same-document reference, we must also indicate the hash algorithm and XML canonicalization // algorithm to be used. 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). This example will add a single same-document reference. A given reference // can be a same-document reference (to an XML fragment), or an external reference.
SigLocation = "SOAP-ENV:Envelope|SOAP-ENV:Header|wsse:Security" // An XML digital signature contains one or more references. To specify the location, set the SigLocation property to the XML path to this element, // using vertical bar characters to separate tags. In this example, the Signature will be placed within the wsse:Security element. Li_rc = loo_XmlSigGen.ConnectToNewObject( " Chilkat_9_5_0.XmlDSigGen") // For example, the application must provide the following: // - Where to put the signature. embed the signature within // the SOAP XML), we specify what is desired, and then call the method to // create the XML signature. Return end if // To create the XML digital signature (i.e. LoadPemFile( "qa_data/ecc/secp256r1-key.pem") Li_rc = loo_EcKey.ConnectToNewObject( " Chilkat_9_5_0.PrivateKey") For your convenience, Chilkat put this sample ECDSA PEM here: This example // will load from an unencrypted PEM file. There are many ways to load an ECDSA private key using Chilkat. Return end if // This example uses an ECDSA private key for signing. Li_rc = loo_Http.ConnectToNewObject( " Chilkat_9_5_0.Http") The SOAP XML to be signed in this example contains the following: // // // // // // // // // // // The above XML is available at // Fetch the XML and then sign it. See Global Unlock Sample for sample code. This example requires the Chilkat API to have been previously unlocked. This example requires Chilkat v9.5.0.69 or greater.
LIANJA APP BUILDER WITH EXTERNAL SQL HOW TO
(PowerBuilder) Create XML Digital Signature using a ECDSA Keyĭemonstrates how to create an XML digital signature using a ECDSA key.