Re: Json Web Keys again

2019-12-04 Thread Angus Robertson - Magenta Systems Ltd
> There isn't a key specific format for Ed25519. > You need to use i2d_PUBKEY() for that. I used EVP_PKEY_get_raw_public_key which got added for these raw keys, works fine for Ed25519. On the EVP_PKEY_get_raw_public_key.html page, it would help if it mentioned that *len should be set to the

Re: Json Web Keys again

2019-12-04 Thread Matt Caswell
On 04/12/2019 11:22, Angus Robertson - Magenta Systems Ltd wrote: >>> It seems the EVP_PKEY_RSA_PSS addition was only committed 28th >>> October 2019, so need to wait for 1.1.1e, hopefully real soon... >> >> Ah, that explains it! > > Now tested with 1.1.1e-dev and I can generate a JWK from an

Re: Json Web Keys again

2019-12-04 Thread Angus Robertson - Magenta Systems Ltd
> > It seems the EVP_PKEY_RSA_PSS addition was only committed 28th > > October 2019, so need to wait for 1.1.1e, hopefully real soon... > > Ah, that explains it! Now tested with 1.1.1e-dev and I can generate a JWK from an RSA-PSS key. Since JWK is for signing, I also tried to support ED25519

Re: Json Web Keys again

2019-12-04 Thread Matt Caswell
On 03/12/2019 19:07, Angus Robertson - Magenta Systems Ltd wrote: >>> Agreed, code looks clear enough, but was this was for 1.1.1 or >>> master? >> >> This code looks the same in 1.1.1 and master. > > It seems the EVP_PKEY_RSA_PSS addition was only committed 28th October > 2019, so need to

Re: Json Web Keys again

2019-12-03 Thread Angus Robertson - Magenta Systems Ltd
> > Agreed, code looks clear enough, but was this was for 1.1.1 or > > master? > > This code looks the same in 1.1.1 and master. It seems the EVP_PKEY_RSA_PSS addition was only committed 28th October 2019, so need to wait for 1.1.1e, hopefully real soon... RSA_get0_pss_params as well would be

Re: Json Web Keys again

2019-12-03 Thread Matt Caswell
On 03/12/2019 18:02, Angus Robertson - Magenta Systems Ltd wrote: >>> Sorry. My mistake. I actually meant what does EVP_PKEY_id() >> return. > > Also returns 912, the same as base_id. RSA keys both return 6. > >> So if you get EVP_PKEY_RSA_PSS returned from that I don't >> currently

Re: Json Web Keys again

2019-12-03 Thread Angus Robertson - Magenta Systems Ltd
>> Sorry. My mistake. I actually meant what does EVP_PKEY_id() > return. Also returns 912, the same as base_id. RSA keys both return 6. > So if you get EVP_PKEY_RSA_PSS returned from that I don't > currently understand how this: > > RSA *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey) > { > if

Re: Json Web Keys again

2019-12-03 Thread Matt Caswell
On 03/12/2019 17:23, Angus Robertson - Magenta Systems Ltd wrote: >> What does EVP_PKEY_base_id() return for your pkey? How did you >> create it? > > base_id is 912, EVP_PKEY_RSA_PSS=NID_rsassaPss. Sorry. My mistake. I actually meant what does EVP_PKEY_id() return. That just does this:

Re: Json Web Keys again

2019-12-03 Thread Angus Robertson - Magenta Systems Ltd
> What does EVP_PKEY_base_id() return for your pkey? How did you > create it? base_id is 912, EVP_PKEY_RSA_PSS=NID_rsassaPss. But my code is Pascal so not using your header files directly, seems okay though. It was created with OpenSSL APIs and EVP_PKEY_print_private reports: RSA-PSS

Re: Json Web Keys again

2019-12-03 Thread Matt Caswell
On 03/12/2019 16:59, Angus Robertson - Magenta Systems Ltd wrote: >>> I create an RSA JWK using EVP_PKEY_get1_RSA and RSA_get0_key, >>> but this does not work for RSA-PSS. >> >> In what way does this not work? > > error:0607907F:digital envelope routines: EVP_PKEY_get0_RSA:expecting > an rsa

Re: Json Web Keys again

2019-12-03 Thread Angus Robertson - Magenta Systems Ltd
> > I create an RSA JWK using EVP_PKEY_get1_RSA and RSA_get0_key, > > but this does not work for RSA-PSS. > > In what way does this not work? error:0607907F:digital envelope routines: EVP_PKEY_get0_RSA:expecting an rsa key > I notice that 3.0 recently had the accessor RSA_get0_pss_params() >

Re: Json Web Keys again

2019-12-03 Thread Matt Caswell
On 03/12/2019 16:29, Angus Robertson - Magenta Systems Ltd wrote: > Google has started using RSA-PSS private keys for Json Web Keys. > > I create an RSA JWK using EVP_PKEY_get1_RSA and RSA_get0_key, but this > does not work for RSA-PSS. In what way does this not work? Perhaps you are