<div dir="auto">I never used this engine, so I can't help, but maybe I'll be able to provide some patch if necessary. <div dir="auto"><br></div><div dir="auto">I usually check if the specified config file and engine is loaded using strace. I remember that it is never loaded when openssl is linked statically. </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 9 Feb 2021, 21:01 Jaromir Talir, <<a href="mailto:jaromir.talir@nic.cz">jaromir.talir@nic.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I guess I tried that and failed, but I'll give it another try. There is<br>
at least question how to identify key. Did you use the same approach as<br>
in nss crypto with KeyName in template?<br>
<br>
Regards,<br>
Jaromir<br>
<br>
On Tue, 2021-02-09 at 20:50 +0100, Dmitry Belyavsky wrote:<br>
> 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>
> ======<br>
> and OPENSSL_CONF=openssl.conf xmlsec1... should allow the engine to<br>
> load if the library is not built statically.<br>
> <br>
> Not sure it will ask the password.<br>
> <br>
> <br>
> <br>
> On Tue, Feb 9, 2021 at 8:46 PM Jaromir Talir <<a href="mailto:jaromir.talir@nic.cz" target="_blank" rel="noreferrer">jaromir.talir@nic.cz</a>><br>
> wrote:<br>
> > Hi Dmitry,<br>
> > <br>
> > this would be great. I was able to use openssl with 'engine pkcs11<br>
> > -<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<br>
> > do<br>
> > > it using openssl pkcs11 engine.<br>
> > > <br>
> > > On Tue, Feb 9, 2021 at 8:00 PM Jaromir Talir<br>
> > <<a href="mailto:jaromir.talir@nic.cz" target="_blank" rel="noreferrer">jaromir.talir@nic.cz</a>><br>
> > > wrote:<br>
> > > > Hi Aleksey,<br>
> > > > <br>
> > > > I'm afraid this needs much deeper understanding of internals<br>
> > 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<br>
> > 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<br>
> > 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<br>
> > ODT<br>
> > > > > > document with the key on the token. I was asked for PIN in<br>
> > GUI.<br>
> > > > > > <br>
> > > > > > So the question for the audience is - how to pass PIN to<br>
> > 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<br>
> > 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" rel="noreferrer">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<br>
> > 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,<br>
> > it's<br>
> > > > > > > invoked by<br>
> > > > > > > LibreOffice. Perhaps see if your HW works with<br>
> > 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" rel="noreferrer">xmlsec@aleksey.com</a><br>
> > > > > > <a href="http://www.aleksey.com/mailman/listinfo/xmlsec" rel="noreferrer 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" rel="noreferrer">xmlsec@aleksey.com</a><br>
> > > > <a href="http://www.aleksey.com/mailman/listinfo/xmlsec" rel="noreferrer noreferrer" target="_blank">http://www.aleksey.com/mailman/listinfo/xmlsec</a><br>
> > > <br>
> > > <br>
> > <br>
> > <br>
> <br>
> <br>
<br>
<br>
</blockquote></div>