Call own sign/verify callback - engine

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Call own sign/verify callback - engine

Pedro Filipe
Hello,

I'd like that my callback is called when a sign/verify is being requested by
*EVP_DigestSignFinal()* function.
I've tried add a EVP_PKEY_METHOD to app_methods stack, that works good
however doesnt fit on my solution.

I noticed that creating an engine and set pkey methods there, it could solve
it.
I looked at gost engine to have in mind what I should do.
So, in engine I call *ENGINE_set_pkey_meths()*, so far so good.

The issue occurs when I try to assign a RSA key. I call
*EVP_PKEY_assign(*outKey, NID_sha1WithRSAEncryption, key);*. The error
returned is *pkey_set_type:unsupported algorithm*.

Most probably I'm missing something.

If *EVP_PKEY_assign()*worked I will call *EVP_DigestSignInit(ctx, NULL,
sha1(), engine, pkey)*.

Thanks in advance.  
Reply | Threaded
Open this post in threaded view
|

Re: Call own sign/verify callback - engine

Dmitry Belyavsky-3
If you are using RSA, maybe it should be useful to look at some RSA implementations, such as engines/e_devcrypto.c

On Thu, Feb 6, 2020 at 7:23 PM Pedro Lopes <[hidden email]> wrote:
Hello,

I'd like that my callback is called when a sign/verify is being requested by
*EVP_DigestSignFinal()* function.
I've tried add a EVP_PKEY_METHOD to app_methods stack, that works good
however doesnt fit on my solution.

I noticed that creating an engine and set pkey methods there, it could solve
it.
I looked at gost engine to have in mind what I should do.
So, in engine I call *ENGINE_set_pkey_meths()*, so far so good.

The issue occurs when I try to assign a RSA key. I call
*EVP_PKEY_assign(*outKey, NID_sha1WithRSAEncryption, key);*. The error
returned is *pkey_set_type:unsupported algorithm*.

Most probably I'm missing something.

If *EVP_PKEY_assign()*worked I will call *EVP_DigestSignInit(ctx, NULL,
sha1(), engine, pkey)*.

Thanks in advance.  


--
SY, Dmitry Belyavsky