<div dir="ltr"><div dir="ltr">It's rather simple to use the engine via config.<br><br>Smth like<br>======<br>openssl_conf = openssl_def<br>[openssl_def]<br>engines = engine_section<br><br>[engine_section]<br>pkcs11 = pkcs11_section<br><br>[pkcs11_section]<br>engine_id = pkcs11<br>dynamic_path = /path/to/engine.so<br>default_algorithms = ALL<br>======</div><div dir="ltr">and OPENSSL_CONF=openssl.conf xmlsec1... should allow the engine to load if the library is not built statically.</div><div dir="ltr"><br></div><div dir="ltr">Not sure it will ask the password.<br><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 9, 2021 at 8:46 PM Jaromir Talir <<a href="mailto:jaromir.talir@nic.cz">jaromir.talir@nic.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Dmitry,<br>
<br>
this would be great. I was able to use openssl with 'engine pkcs11 -<br>
keyform engine -inkey "pkcs11:..."'  but haven't found a way how to<br>
pass this to xmlsec1. In the xmlsec1 mailing list archives it is<br>
mentioned there may be a way to get this into openssl config but<br>
without conclusion. <br>
<br>
Can you please share what was your approach?<br>
<br>
Regards,<br>
Jaromir <br>
<br>
On Tue, 2021-02-09 at 20:38 +0100, Dmitry Belyavsky wrote:<br>
> Hi Jaromir,<br>
> <br>
> I had some experience using xmlsec-openssl with PKCS#11-capable<br>
> engine and PKCS11-based keys, so I think it could be possible to do<br>
> it using openssl pkcs11 engine.<br>
> <br>
> On Tue, Feb 9, 2021 at 8:00 PM Jaromir Talir <<a href="mailto:jaromir.talir@nic.cz" target="_blank">jaromir.talir@nic.cz</a>><br>
> wrote:<br>
> > Hi Aleksey,<br>
> > <br>
> > I'm afraid this needs much deeper understanding of internals than I<br>
> > have. It's quite surprising nobody tried it in 15? years. Maybe<br>
> > author<br>
> > of libreoffice xmlsec client could assist in debugging where this<br>
> > PIN<br>
> > enters the API and than CLI could be updated to follow the same<br>
> > path?<br>
> > <br>
> > Regards,<br>
> > Jaromir  <br>
> > <br>
> > On Tue, 2021-02-09 at 08:19 -0800, Aleksey Sanin wrote:<br>
> > > Hi Jaromir,<br>
> > > <br>
> > > I never tested passing password to the token from CLI. If you can<br>
> > > debug it then I would gladly accept patches :)<br>
> > > <br>
> > > Best,<br>
> > > <br>
> > > Aleksey<br>
> > > <br>
> > > On 2/9/21 1:42 AM, Jaromir Talir wrote:<br>
> > > > Hi Miklos,<br>
> > > > <br>
> > > > I tried LibreOffice with NSS backend and I was able to sign ODT<br>
> > > > document with the key on the token. I was asked for PIN in GUI.<br>
> > > > <br>
> > > > So the question for the audience is - how to pass PIN to NSS in<br>
> > > > xmlsec1<br>
> > > > cli?<br>
> > > > <br>
> > > > The last possible problem can be in KeyName so the other<br>
> > question<br>
> > > > is -<br>
> > > > is the described process to guess KeyName from token correct?<br>
> > > > <br>
> > > > Regards,<br>
> > > > Jaromir<br>
> > > > <br>
> > > > On Tue, 2021-02-09 at 09:46 +0100, Miklos Vajna wrote:<br>
> > > > > Hi Jaromir,<br>
> > > > > <br>
> > > > > On Mon, Feb 08, 2021 at 10:16:17PM +0100, Jaromir Talir<br>
> > > > > <<a href="mailto:jaromir.talir@nic.cz" target="_blank">jaromir.talir@nic.cz</a>> wrote:<br>
> > > > > > good to hear you have succeeded. I played with nss and<br>
> > pkcs11<br>
> > > > > > and<br>
> > > > > > seems<br>
> > > > > > like I'm almost there but still not fully. I guess I<br>
> > managed to<br>
> > > > > > get<br>
> > > > > > over task how to find proper keyname but xmlsec1 still<br>
> > cannot<br>
> > > > > > find<br>
> > > > > > the<br>
> > > > > > key in the token. I suspect that problem may be in PIN code<br>
> > > > > > (i.e<br>
> > > > > > "123456") that needs to be entered and I'm not sure if<br>
> > xmlsec1<br>
> > > > > > "--<br>
> > > > > > pwd"<br>
> > > > > > parameter is used for this.<br>
> > > > > <br>
> > > > > To be clear, we only use the library part of xmlsec1, it's<br>
> > > > > invoked by<br>
> > > > > LibreOffice. Perhaps see if your HW works with LibreOffice<br>
> > (try<br>
> > > > > to<br>
> > > > > sign<br>
> > > > > e.g. an ODT file), and if so, track down how your code vs<br>
> > xmlsec1<br>
> > > > > cli<br>
> > > > > vs<br>
> > > > > LibreOffice uses the xmlsec1 library?<br>
> > > > > <br>
> > > > > Seeing you're on Linux, I only tried this with the NSS<br>
> > backend of<br>
> > > > > xmlsec1.<br>
> > > > > <br>
> > > > > Regards,<br>
> > > > > <br>
> > > > > Miklos<br>
> > > > <br>
> > > > <br>
> > > > _______________________________________________<br>
> > > > xmlsec mailing list<br>
> > > > <a href="mailto:xmlsec@aleksey.com" target="_blank">xmlsec@aleksey.com</a><br>
> > > > <a href="http://www.aleksey.com/mailman/listinfo/xmlsec" rel="noreferrer" target="_blank">http://www.aleksey.com/mailman/listinfo/xmlsec</a><br>
> > > > <br>
> > <br>
> > <br>
> > _______________________________________________<br>
> > xmlsec mailing list<br>
> > <a href="mailto:xmlsec@aleksey.com" target="_blank">xmlsec@aleksey.com</a><br>
> > <a href="http://www.aleksey.com/mailman/listinfo/xmlsec" rel="noreferrer" target="_blank">http://www.aleksey.com/mailman/listinfo/xmlsec</a><br>
> <br>
> <br>
<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">SY, Dmitry Belyavsky</div>