Output
When you build and run the KeyFromCertContext code, you should get output in the following format. The likely differences are due to the different certificate contexts (or keys) used.
The data referenced in the signature template was signed successfully. Resultant signature: <?xml version="1.0"?> <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <ds:SignedInfo> <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n -20010315"/> <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/> <ds:Reference URI="#obj"> <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/> <ds:DigestValue>q7jECW4dAYAz6sgkuPIeyzz/vdw=</ds:DigestValue> </ds:Reference> </ds:SignedInfo> <ds:SignatureValue>vqpqpa+/tqW4dJTv3F3K022UI6DiO0EI8kud5BcKSRXofc3KUNvEq7mBnhL Hb4Ihm1om8NtD PRToBPtsOQ6oCA==</ds:SignatureValue> <ds:Object Id="obj">Hello, World!</ds:Object> <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"><KeyValue><RSAKeyValue><Modu lus>wylu+tpOV2xOlM1Up0iQH5v4gI/Of44sPKZxgfwz9BKW+J2QNhfcSIbRx5Lj1u2yp9oGR6ym OiF3LXu+7Rd6Ow==</Modulus><Exponent>AQABAA==</Exponent></RSAKeyValue></KeyValue> </KeyInfo></ds:Signature>