Question about picking PRF when storing a private key

2019-08-26 Thread Caleb An
Hi openssl team & community,

When using the i2d_PKCS8PrivateKey functions
to
encode a private key, is there a way to also select the PBKDF2 PRF?

Thanks so much!
- Caleb An


Re: Add ECDSA signature R and S to X509 structure

2019-08-26 Thread William Roberts
This thread actually has some code on it for doing this:

https://www.mail-archive.com/openssl-users@openssl.org/msg86672.html

Bill

On Mon, Aug 26, 2019 at 9:46 AM Ken Goldman  wrote:
>
> On 8/17/2019 5:35 AM, Billy Brumley wrote:
> > Hey Ken,
> >
> >> I have an ECDSA signature supplied to me as R and S byte arrays and
> >> lengths (from an HSM).
> >>
> >> How do I add them to the X509 structure?
> >>
> >> Is there an API, a set of calls, or do you have any hints?
> >
> > You might be looking for ECDSA_SIG_set0:
> >
> > https://www.openssl.org/docs/man1.1.0/man3/ECDSA_SIG_set0.html
> >
> > You might find some snippets in ecdsatest.c.
> >
> > Hope it helps,
>
> I think so.  This seems to work.  Does it make sense? Is there a better way?
>
> - convert R and S, bin to bignum
> - use ECDSA_SIG_set0 to create an ECDSA_SIG
> - use i2d to convert the ECDSA_SIG to DER
> - memcpy the DER into X509->signature->data
>
>


Re: question about certificate verify

2019-08-26 Thread Viktor Dukhovni
On Mon, Aug 26, 2019 at 02:39:40PM +, Blumenthal, Uri - 0553 - MITLL wrote:

> > To ignore expiration of only the leaf certificate, you
> > need a verification callback that checks the error
> > reason at depth 0 and if it is expiration, returns
> > "ok = 1" anyway.
> 
> Is there a potential problem - if a certificate has multiple issues, such
> as bad signature and certificate expired? Would all of these conditions
> be reported, or only the first one detected?

The verification callback is called separately for each error
condition (and at least once on success if no errors are seen).

It is therefore possible to ignore *just* the expiration of a
particular chain element without ignoring other errors.

-- 
Viktor.


Re: Add ECDSA signature R and S to X509 structure

2019-08-26 Thread Ken Goldman

On 8/17/2019 5:35 AM, Billy Brumley wrote:

Hey Ken,


I have an ECDSA signature supplied to me as R and S byte arrays and
lengths (from an HSM).

How do I add them to the X509 structure?

Is there an API, a set of calls, or do you have any hints?


You might be looking for ECDSA_SIG_set0:

https://www.openssl.org/docs/man1.1.0/man3/ECDSA_SIG_set0.html

You might find some snippets in ecdsatest.c.

Hope it helps,


I think so.  This seems to work.  Does it make sense? Is there a better way?

- convert R and S, bin to bignum
- use ECDSA_SIG_set0 to create an ECDSA_SIG
- use i2d to convert the ECDSA_SIG to DER
- memcpy the DER into X509->signature->data




Re: question about certificate verify

2019-08-26 Thread Blumenthal, Uri - 0553 - MITLL
Is there a potential problem - if a certificate has multiple issues, such as 
bad signature and certificate expired? Would all of these conditions be 
reported, or only the first one detected?

Regards,
Uri

Sent from my iPhone

On Aug 26, 2019, at 10:11, Viktor Dukhovni  wrote:

>> On Aug 26, 2019, at 5:24 AM, forston_...@trendmicro.com wrote:
>> 
>> We check a sub-certificate with a lot of root certificates.
>> We don’t want to check sub-certificate’s expire time, but we want to get an 
>> error when root certificate expired.
>> 
>> I try to verify it by following option,
>>  X509_VERIFY_PARAM* pm = X509_STORE_CTX_get0_param(xstore_ctx);
>>  X509_VERIFY_PARAM_set_flags(pm, X509_V_FLAG_NO_CHECK_TIME);
>> 
>>  iret = X509_verify_cert(xstore_ctx); 
>> 
>> But it also will ignore root certificate’s expire.
>> 
>> So, can you give me some suggestion for my question.
> 
> To ignore expiration of only the leaf certificate, you
> need a verification callback that checks the error
> reason at depth 0 and if it is expiration, returns
> "ok = 1" anyway.
> 
> -- 
>Viktor.
> 


smime.p7s
Description: S/MIME cryptographic signature


Re: question about certificate verify

2019-08-26 Thread Viktor Dukhovni
> On Aug 26, 2019, at 5:24 AM, forston_...@trendmicro.com wrote:
> 
> We check a sub-certificate with a lot of root certificates.
> We don’t want to check sub-certificate’s expire time, but we want to get an 
> error when root certificate expired.
>  
> I try to verify it by following option,
>   X509_VERIFY_PARAM* pm = X509_STORE_CTX_get0_param(xstore_ctx);
>   X509_VERIFY_PARAM_set_flags(pm, X509_V_FLAG_NO_CHECK_TIME);
>  
>   iret = X509_verify_cert(xstore_ctx); 
>  
> But it also will ignore root certificate’s expire.
>  
> So, can you give me some suggestion for my question.

To ignore expiration of only the leaf certificate, you
need a verification callback that checks the error
reason at depth 0 and if it is expiration, returns
"ok = 1" anyway.

-- 
Viktor.



question about certificate verify

2019-08-26 Thread forston_...@trendmicro.com
Hi Openssl team,
I have a question about certificate verify.

We check a sub-certificate with a lot of root certificates.
We don't want to check sub-certificate's expire time, but we want to get an 
error when root certificate expired.

I try to verify it by following option,
  X509_VERIFY_PARAM* pm = X509_STORE_CTX_get0_param(xstore_ctx);
  X509_VERIFY_PARAM_set_flags(pm, X509_V_FLAG_NO_CHECK_TIME);

  iret = X509_verify_cert(xstore_ctx);

But it also will ignore root certificate's expire.

So, can you give me some suggestion for my question.

Best regards
Forston Shi (RD-CN)



TREND MICRO EMAIL NOTICE
The information contained in this email and any attachments is confidential
and may be subject to copyright or other intellectual property protection.
If you are not the intended recipient, you are not authorized to use or
disclose this information, and we request that you notify us by reply mail or
telephone and delete the original message from your mail system.

For details about what personal information we collect and why, please see our 
Privacy Notice on our website at: [ https://www.trendmicro.com/privacy]