<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 10">
<meta name=Originator content="Microsoft Word 10">
<link rel=File-List href="cid:filelist.xml@01C3516A.0FEC6640">
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:DoNotRelyOnCSS/>
</o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:SpellingState>Clean</w:SpellingState>
<w:GrammarState>Clean</w:GrammarState>
<w:DocumentKind>DocumentEmail</w:DocumentKind>
<w:HyphenationZone>21</w:HyphenationZone>
<w:EnvelopeVis/>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-parent:"";
        margin:0cm;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;
        text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;
        text-underline:single;}
span.EpostStil17
        {mso-style-type:personal-compose;
        mso-style-noshow:yes;
        mso-ansi-font-size:10.0pt;
        mso-bidi-font-size:10.0pt;
        font-family:Arial;
        mso-ascii-font-family:Arial;
        mso-hansi-font-family:Arial;
        mso-bidi-font-family:Arial;
        color:windowtext;}
span.SpellE
        {mso-style-name:"";
        mso-spl-e:yes;}
span.GramE
        {mso-style-name:"";
        mso-gram-e:yes;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;
        mso-header-margin:35.4pt;
        mso-footer-margin:35.4pt;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
        {mso-style-name:"Vanlig tabell";
        mso-tstyle-rowband-size:0;
        mso-tstyle-colband-size:0;
        mso-style-noshow:yes;
        mso-style-parent:"";
        mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
        mso-para-margin:0cm;
        mso-para-margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:10.0pt;
        font-family:"Times New Roman";}
</style>
<![endif]-->
</head>
<body lang=NO-BOK link=blue vlink=purple style='tab-interval:35.4pt'>
<div class=Section1>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>I’m trying to sign an enveloped
<span class=SpellE>XML</span>-document with <span class=SpellE>XMLSec</span>
using a <span class=SpellE>SmartCard</span>. <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>In order to do so I’ve
overloaded the default crypto engine with my own <span class=GramE>( handling</span>
Smart Card communication).<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>To create the signature template:<o:p></o:p></span></font></p>
<p class=MsoNormal><span class=SpellE><span class=GramE><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'>xmlSecTmplSignatureCreate</span></font></span></span><span
class=GramE><font size=2 face=Arial><span lang=EN-GB style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:EN-GB'>(</span></font></span><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'>doc, xmlSecTransformInclC14NId,
xmlSecTransformRsaSha1Id, NULL);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>
<p class=MsoNormal><span class=GramE><font size=2 face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>xmlSecTransformRsaSha1Id</span></font></span><font
size=2 face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'> is thus the hashing algorithm for the signature value
calculation (behind the scenes in <span class=SpellE>xmlSecDSigCtxSign</span> ()
). <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>In the overloaded<o:p></o:p></span></font></p>
<p class=MsoNormal><span class=SpellE><font size=2 face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>RSA_private_<span
class=GramE>encrypt</span></span></font></span><span class=GramE><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'>(</span></font></span><span class=SpellE><font size=2
face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'>int</span></font></span><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial;mso-ansi-language:EN-GB'> <span
class=SpellE>len</span>, const unsigned char *from,<span style='mso-tab-count:
1'> </span>unsigned char *to, <span class=SpellE>RSA</span> *<span
class=SpellE>rsa</span>, <span class=SpellE>int</span> padding)<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>
<p class=MsoNormal><span class=SpellE><font size=2 face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>Xmlsec</span></font></span><font
size=2 face=Arial><span lang=EN-GB style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:EN-GB'> asks to get 35 bytes encrypted (<span class=SpellE>len</span>=35).
Normally this would be no problem (even if it is much for a hash value), but my
crypto engine only handles up to 20 bytes/160 bits at the moment. The cause of
the limitation is outside of my source code, so it is out of my reach (binary dynamic
library)…<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'>Any suggestions on how to get
<span class=SpellE>xmlsec</span> to ask for less <span class=GramE>bytes</span>
to be signed?<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New";mso-ansi-language:EN-GB;
mso-no-proof:yes'>W | Hårek Ryeng, Senior System Developer<br>
E | Well Diagnostics AS, Forskningsparken, 9291 Tromsø<br>
L | Tel: +47 77 75 76 79 (70), Cell: +47 970 05 022, Fax: +47 77 75 76 99<br>
L | </span></font><span style='mso-no-proof:yes'><a
href="http://www.welldiagnostics.com/"><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";mso-ansi-language:
EN-GB'>http://www.welldiagnostics.com/</span></font></a><a
href="http://www.welldiagnostics.com/"></a></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt;mso-ansi-language:EN-GB'><o:p> </o:p></span></font></p>
</div>
</body>
</html>