Re: [openssl-users] [EXTERNAL] scripting creating a cert

2017-03-31 Thread Nichols, Timothy (Checkpoint)
Hi, did you get your answer to this? I just discovered 134 messages in the 
folder I'd set up for receiving said messages...and promptly forgot to check 
for same.

I just went through this exercise and have set up my configuration files and 
bash script to generate certificates.

-TN (Tim)

-Original Message-
From: openssl-users [mailto:openssl-users-boun...@openssl.org] On Behalf Of 
Robert Moskowitz
Sent: Thursday, March 09, 2017 15:50
To: openssl-users@openssl.org
Subject: [EXTERNAL] [openssl-users] scripting creating a cert

I am creating self-signed certs with:

openssl req -new -outform PEM -out certs/$your_host_tld.crt -newkey
rsa:2048 -nodes -keyout private/$your_host_tld.key -keyform PEM -days
3650 -x509 -extensions v3_req

Where, for example:

your_host_tld=z9m9z.test.htt-consult.com

Thing is that this then prompts for a number of fields:

Country Name (2 letter code) [XX]:
State or Province Name (full name) []:
Locality Name (eg, city) [Default City]:
Organization Name (eg, company) [Default Company Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:
Email Address []:

Is there some 'simple' way to provide these answers?  Like with env variables?

thanks


--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


Re: [openssl-users] In ssl3_write_bytes, some checks related to hanlding write failure are missing

2017-03-31 Thread Raja ashok
Hi All,

In ssl3_write_bytes, if (len < tot) we are returning failure with 
SSL_R_BAD_LENGTH error. In this place I hope we should set “tot” back to 
“s->s3->wnum”. Otherwise when application calls back SSL_write with correct 
buffer, it causes serious problem (“tot” is 0 and iLeft is not NULL). I hope we 
should do like below.

if (len < tot) {
s->s3->wnum = tot;
SSLerr(SSL_F_SSL3_WRITE_BYTES, SSL_R_BAD_LENGTH);
   return (-1);
}

And also we should do one additional check for “len” as mentioned in my 
previous mail.

if ((len < tot) || ((tot != 0) && (len < (tot + s->s3->wpend_tot{
s->s3->wnum = tot;
SSLerr(SSL_F_SSL3_WRITE_BYTES, SSL_R_BAD_LENGTH);
   return (-1);
}

Regards,
Ashok


[Company_logo]

Raja Ashok V K
Huawei Technologies
Bangalore, India
http://www.huawei.com

本邮件及其附件含有华为公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁
止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中
的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!
This e-mail and its attachments contain confidential information from HUAWEI, 
which
is intended only for the person or entity whose address is listed above. Any 
use of the
information contained herein in any way (including, but not limited to, total 
or partial
disclosure, reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please notify 
the sender by
phone or email immediately and delete it!

From: Raja ashok
Sent: 27 March 2017 13:55
To: 'openssl-users@openssl.org'; 'openssl-...@openssl.org'
Subject: In ssl3_write_bytes, some checks related to hanlding write failure are 
missing

Hi,

I feel there is a check missing in ssl3_write_bytes, in case of handling write 
failure.

Consider SSL_write is called with 2 bytes buffer, then internally in 
ssl3_write_bytes we try to send it as two record (16384 and 3616). If TCP send 
failed for the second record then we store the states internally (wnum, 
wpend_tot and wpend_buf) and return back the result.

Later application has to call SSL_write with same buffer, if it calls with 
different buffer of length 100 byte then we fail that in ssl3_write_bytes using 
the check (len < tot).

But consider application calls with buffer of size 18000 bytes and 
SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER is enabled. Then (len < tot) will not 
succeed as tot is 16384. Then it will call ssl3_write_pending to send the 
remaining 3616 record. If it succeeds we are incrementing tot, (tot += i). Now 
tot will have 2.

Later there is a check (tot == len), this will not succeed. Then directly we 
are doing n = (len - tot), this will overflow and store a value close to 2^32 
in n. Then it will cause out of bound access to the application buffer "buf".

I hope we should have one more check (len < (tot + s->s3->wpend_tot)) before 
calling ssl3_write_pending.

if ((len < tot) || (len < (tot + s->s3->wpend_tot))){
SSLerr(SSL_F_SSL3_WRITE_BYTES, SSL_R_BAD_LENGTH);
return (-1);
}

Note : I am referring 1.0.2k version of OpenSSL.

Regards,
Ashok


[Company_logo]

Raja Ashok V K
Huawei Technologies
Bangalore, India
http://www.huawei.com

本邮件及其附件含有华为公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁
止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中
的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!
This e-mail and its attachments contain confidential information from HUAWEI, 
which
is intended only for the person or entity whose address is listed above. Any 
use of the
information contained herein in any way (including, but not limited to, total 
or partial
disclosure, reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please notify 
the sender by
phone or email immediately and delete it!

-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


Re: [openssl-users] openssl verify with 1B certificates

2017-03-31 Thread Jakob Bohm

Also consider using the functions that the "openssl verify"
command uses (source file: apps/verify.c), perhaps from a
bulk process that can be run on each CPU node on your
compute cluster.  With a little thought, these can be done
efficiently, with lots of reused (i.e. not repeated) actions,
such as setting up parameters, loading known CA and intermediary
certs, opening files that contain multiple certs, etc.

On 30/03/2017 22:10, Richard Moore wrote:

Depends what information you need - if you just need a binary
valid/not valid then prune it first then verify. If you want a more
fine grained data set then don't. Write some code  - forking and
running openssl verify each time will be insanely slow - don't do
that. I doubt you really have a billion unique certificates - avoid
testing duplicates. Also don't forget that you really need certificate
chains, so I hope you captured the intermediate certificates too!

Cheers

Rich.

On 30 March 2017 at 18:44, ebe ebe >wrote:

Hello,

I am a CS graduate student and doing a measurement study regarding
the SSL ecosystem. I have approximately 1 billion SSL certificates
and I would like to run openssl verify on each certificate to sift
out invalid certificates. My major concern, as you might guess, is
whether doing this verification is feasible given the size of my
dataset. An alternative idea I have is to replicate the
verification steps of openssl. More specifically, I am working
with a Hadoop infrastructure and I can perform some of the
verification steps without running into scalability issues (e.g is
certificate between notBefore-notAfter timestamps, subject
key key identifier checks). However, with this approach
I feel like verifying the signature would be a big challenge. Any
ideas on how I can tackle these problems?





--
Jakob Bohm, CIO, partner, WiseMo A/S. https://www.wisemo.com
Transformervej 29, 2860 Soborg, Denmark. direct: +45 31 13 16 10 


This message is only for its intended recipient, delete if misaddressed.
WiseMo - Remote Service Management for PCs, Phones and Embedded


Enjoy

Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded
--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


Re: [openssl-users] ca's config options -certs vs. -new_certs_dir

2017-03-31 Thread Nichols, Timothy (Checkpoint)
Thank you, sir. I was attacking this from the standpoint of needing to generate 
several thousand certificates for testing purposes and so unique certificates 
went to unique files. I think I must have used -out by itself, though I believe 
I tried the -outdir option at the end when I tried to tighten up my script.

I didn't think when I undertook this effort that it would turn into such a slog 
wherein I'd need to understand all this minutia. Now, much to my surprise, I 
love this stuff...

-TN

From: openssl-users [mailto:openssl-users-boun...@openssl.org] On Behalf Of 
Michael Wojcik
Sent: Wednesday, March 08, 2017 13:39
To: openssl-users@openssl.org
Subject: [EXTERNAL] Re: [openssl-users] ca's config options -certs vs. 
-new_certs_dir

It's because processing a request can generate multiple certificates. Therefore 
ca needs a destination where it can write multiple certificates, not just a 
single one.

Note that new_certs_dir is only used if -outdir wasn't specified on the command 
line. You could create a temporary directory, pass its pathname with -outdir, 
then remove the directory and its contents after running ca.

With -out, all the certificates are just concatenated to the file. Usually 
they're PEM, so that's OK; the exception is if -spkac is used to specify an 
SPKAC file. SPKAC is mostly used in conjunction with the HTML KEYGEN element, 
when interpreted by Firefox and some other browsers. So you could argue that 
-outdir / new_certs_dir should be optional, since usually the single output 
file is more or less usable.

But it isn't optional, and that's life.

Of course, if you're building OpenSSL from source, it wouldn't be hard to make 
the necessary changes to ca.c.

Michael Wojcik
Distinguished Engineer, Micro Focus



From: openssl-users [mailto:openssl-users-boun...@openssl.org] On Behalf Of 
Nichols, Timothy (Checkpoint)
Sent: Wednesday, March 08, 2017 13:57
To: openssl-users@openssl.org
Subject: [openssl-users] ca's config options -certs vs. -new_certs_dir

Hi, I am not understanding the point of the config file's mandatory default 
-new_certs_dir into which goes what appears to be a copy of the certificate I 
specifically locate elsewhere in the file system. I am using the -out option 
from the command line to generate the file named according to the convention I 
have chosen...and then in the new_certs directory is deposited the .pem 
file. Of course, I haven't found an explanation as to why this happens in the 
documentation or the Googlie.

Thanks,

Tim
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


Re: [openssl-users] openssl verify with 1B certificates

2017-03-31 Thread Michael Wojcik
A lot depends on what you mean by "verify", too.  TLS endpoints should perform 
a large number of checks on certificates; some of them aren't relevant for your 
purposes, and others might not be.

For example, a TLS client such as a browser will check whether the received 
entity certificate identifies the peer it wants to connect to - generally 
checking the subjAltName extensions, and possibly falling back on e.g. the CN 
of the subject DN if the certificate isn't X.509v3. That's not relevant in your 
case.

And then there are things like CRLs and OCSP checks. If you don't care about 
those, obviously that's work you don't have to do. What about, oh, certificate 
purpose, for example? Do you care about the chain length?

So what are you checking? My guess is the list is something like this:
1. Object is a valid X.509 certificate (ASN.1 parsing doesn't show any errors, 
structure is appropriate, contains required fields...).
2. Within the validity period, as you noted in your original message.
3. Valid signature. This means you'll need the public key of the signing 
certificate, of course. Are you going to chase it all the way to the root? Do 
you care about whether the root's in some collection of trust anchors?

That's a lot simpler than verifying a peer certificate for TLS - my checklist 
for that is 11 steps, and recurses as it walks the chain. But it's still a fair 
bit of work.

Personally, for a project like this, as I harvested public keys I'd put them in 
a NoSQL key-value store, with the certificate subject DN as the key. Then I 
wouldn't have to find and parse the signing certificate for step 3, if I'd 
already stored the corresponding key.

Michael Wojcik 
Distinguished Engineer, Micro Focus 



-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users