[openssl-users] To disable CBC ciphers

2018-10-16 Thread Kaushal Shriyan
Hi,

I have the below ssl settings in nginx.conf file and VAPT test has reported
us to disable CBC ciphers

ssl_ciphers HIGH:!aNULL:!MD5:!DH+3DES:!kEDH;
> ssl_protocols TLSv1 TLSv1.1 TLSv1.2;


openssl version on the box is OpenSSL 1.0.2k-fips 26 Jan 2017 on CentOS
Linux release 7.3.1611 (Core)

I will appreciate if someone can pitch in to help me understand to disable
CBC ciphers

Best Regards

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


[openssl-users] Chrome 70 with final tls 1.3 is out

2018-10-16 Thread Juan Isoza
Chrome 70 with final tls 1.3 install itself with automatic update. So there
will be a lot of tls 1.3 client !

And Firefox will update next week
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


Re: [openssl-users] OpenSSL occasionally generates wrong signature

2018-10-16 Thread Dmitry
Looks like there is some problem in higher-level EVP_ functions.

I completely rewrote the example using lower-level ECDSA_do_sign and it
started to work always.

Here is the code:
   EVP_MD_CTX *Ctx = EVP_MD_CTX_create();
   EVP_DigestInit(Ctx, EVP_sha256());
   EVP_DigestUpdate(Ctx, dt.data(), dt.size());
   QByteArray Digest;
   Digest.resize(EVP_MAX_MD_SIZE);
   unsigned int Len;
   EVP_DigestFinal(Ctx, reinterpret_cast(Digest.data()),
&Len);
   Digest.resize(Len);

   BIO *   Bio   = BIO_new_mem_buf(pk.data(), pk.size());
   EC_KEY *ECKey = PEM_read_bio_ECPrivateKey(Bio, nullptr, nullptr,
nullptr);
   ECDSA_SIG *Signature = ECDSA_do_sign(reinterpret_cast(Digest.data()), Digest.size(), ECKey);
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


[openssl-users] reasons for negative return value from BIO_do_connect

2018-10-16 Thread Richard Welty
i'm trying to figure out why BIO_do_connect is failing with
a negative value. so far as i know i've done all preliminaries
correctly, but apparently i've missed something. i am dumping
the SSL errors from ERR_get_error but am not getting any in
this instance.

OpenSSL version is 1.1.0h

Ubuntu 18.04 running in a VM on a Mac Mini. the network is setup
in bridged adapter mode so that the VM has a distinct IP address
from the host. i have used nmap to verify that i can reach the
target server and that the port the server is listening on is
open. the owner of the server assures me that his app is up and
listening.

i have verified with both wireshark and by looking at the logs
on the server i'm trying to reach that no actual traffic went out.

the following is output from the test run. note that i print out
the values of IP and port using BIO_get_conn_hostname and
BIO_get_conn_port to insure that i did all the processing
correctly.

TLS method obtained
TLS context established
NTS: options and ALPN protos set
NTS: remote peer bio created
141.41.241.68
NTS: remote peer hostname set to '141.41.241.68'
NTS: server port set to '443'
NTS: ssl bio obtained
NTS: ciphers set
16 Oct 13:15:39 ntpd[4439]: failed to connect to server

here is the code which is failing:

struct tls_connection* nts_tls_connect( struct peer *peer){

  long result;
  struct tls_connection* connection = malloc( sizeof (struct
tls_connection));
  connection->sock = -1;
  connection->ctx = NULL;
  connection->remote_peer = NULL;
  connection->ssl = NULL;
  connection->ke_buffer = malloc( MAX_KE_RESPONSE);

  const SSL_METHOD* method = TLSv1_2_client_method();
  if( method == NULL){
msyslog( LOG_ERR, "Failed to obtain TLS 1.2 method from OpenSSL");
free_tls_connection( connection);
return NULL;
  }

  DPRINTF( 1, ("TLS method obtained\n"));

  connection->ctx = SSL_CTX_new( method);
  if( connection->ctx == NULL){
msyslog( LOG_ERR, "Failed to establish TLS context");
dprintf_ssl_error();
free_tls_connection( connection);
return NULL;
  }

  DPRINTF( 1, ("TLS context established\n"));

  // verification turned off for proof of concept
  // SSL_CTX_set_verify( connection->ctx, SSL_VERIFY_PEER, NULL);
  // SSL_CTX_set_verify_depth( connection->ctx, 4);

  const long flags
= SSL_OP_NO_SSLv2
| SSL_OP_NO_SSLv3
| SSL_OP_NO_TLSv1
| SSL_OP_NO_TLSv1_1
| SSL_OP_NO_COMPRESSION;
  SSL_CTX_set_options( connection->ctx, flags);

  result = SSL_CTX_set_alpn_protos( connection->ctx,
 alpn_ntske,
 sizeof( alpn_ntske));
  if( result != 0){
msyslog( LOG_ERR, "failed to set ALPN protos");
dprintf_ssl_error();
free_tls_connection( connection);
return NULL;
  }

  DPRINTF( 1, ("NTS: options and ALPN protos set\n"));

  // verification turned off for hackathon
  // SSL_CTX_load_verify_locations...

  connection->remote_peer = BIO_new_ssl_connect( connection->ctx);
  if( connection->remote_peer == NULL){
msyslog( LOG_ERR, "failed to create remote_peer BIO chain");
free_tls_connection( connection);
return NULL;
  }

  DPRINTF( 1, ("NTS: remote peer bio created\n"));

  if( peer->hostname != NULL){
result = BIO_set_conn_hostname( connection->remote_peer,
peer->hostname);
  } else {
char *addr = address_string( &peer->srcadr);
result = BIO_set_conn_hostname( connection->remote_peer,addr);
free( addr);
  }
  if( result != 1){
msyslog( LOG_ERR, "failed to set remote peer hostname");
free_tls_connection( connection);
return NULL;
  }

  DPRINTF( 1, ("NTS: remote peer hostname set to \'%s\'\n",
   BIO_get_conn_hostname( connection->remote_peer)));

  result = BIO_set_conn_port( connection->remote_peer, NTS_KE_PORT);
  if( result != 1){
msyslog( LOG_ERR, "failed to set server port");
free_tls_connection( connection);
return NULL;
  }

  DPRINTF( 1, ("NTS: server port set to \'%s\'\n",
   BIO_get_conn_port( connection->remote_peer)));

  BIO_get_ssl( connection->remote_peer, &connection->ssl);
  if( connection->ssl == NULL){
msyslog( LOG_ERR, "failed to get SSL from BIO");
free_tls_connection( connection);
return NULL;
  }

  DPRINTF( 1, ("NTS: ssl bio obtained\n"));

  const char* PREFERRED_CIPHERS = "HIGH:AES256:AES128";
  result = SSL_set_cipher_list( connection->ssl, PREFERRED_CIPHERS);
  if( result != 1){
msyslog( LOG_ERR, "failed to set cipher list");
dprintf_ssl_error();
free_tls_connection( connection);
return NULL;
  }

  DPRINTF( 1, ("NTS: ciphers set\n"));

/*
   connection->evbase = event_base_new();
  struct buffer_event *bev
= bufferevent_openssl_socket_new( connection->evbase,
  -1, connection->ssl,
  BUFFEREVENT_SSL_CONNECTING,
  BEV_OPT_CLOSE_ON_FREE);
  */

  result = BIO_do_connect( connection->remote_peer);
  if( result

Re: [openssl-users] OpenSSL occasionally generates wrong signature

2018-10-16 Thread Dmitry
Thank you for the hint, but it looks like the problem is somewhere else

I rewrote the piece of code in such a way:
char *Result = new char [SignatureLength];
EVP_DigestSignFinal(Ctx, reinterpret_cast(Result),
&SignatureLength);

TFile SignatureBin = {"/home/gc/signature.bin", ...};
SignatureBin.Write(Result, SignatureLength);

but the problem still persists.
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


Re: [openssl-users] BIO_printf with ASN1_BIT_STRING and ASN1_INTEGER?

2018-10-16 Thread Dave Coombs
Depends what you want it to print, I guess...  ASN1_STRING_print_ex() can print 
any ASN1_STRING (including an ASN1_BIT_STRING) but it'll come out binary 
packed.  If you want to do anything fancier like print individual bit values in 
a more human-readable way, you'll have to do it yourself, as far as I know.

  -Dave


> On Oct 16, 2018, at 10:32, Opa114  wrote:
> 
> Hi,
> 
> thanks for this - what about the ASN1_BIT_STRING? Is there such a predefined 
> function?
> 
> Von: openssl-users  > im Auftrag von Dave Coombs 
> mailto:dcoo...@carillon.ca>>
> Gesendet: Dienstag, 16. Oktober 2018 15:17 Uhr
> An: openssl-users@openssl.org 
> Betreff: Re: [openssl-users] BIO_printf with ASN1_BIT_STRING and ASN1_INTEGER?
>  
> Hi,
> 
> You can use i2a_ASN1_INTEGER() to print an ASN1_INTEGER to a BIO.
> 
>   -Dave
> 
> 
>> On Oct 16, 2018, at 05:37, Opa114 mailto:opa...@web.de>> 
>> wrote:
>> 
>> Hi there,
>> 
>> i have to print out some data, which is an ASN1_BIT_STRING and an 
>> ASN1_INTEGER with BIO_printf. For GENERAL_NAME for example there a 
>> predefined functions i can use like this: GENERAL_NAME_print(bp, 
>> GENERAL_NAME_VAR) <= 0
>> 
>> But for ASN1_INTGER and ASN1_BIT_STRING i haven't found any predefined 
>> function like ASN1_INTEGER_PRINT or something similiar i can use. So can 
>> someone tell me how i print out these two data types with BIO_printf in the 
>> correct and actual way?
>> 
>> thanks a lot.
>> -- 
>> 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] OpenSSL occasionally generates wrong signature

2018-10-16 Thread Jakob Bohm via openssl-users

On 16/10/2018 16:39, Dmitry wrote:

Hello!

I have a C++ programme, ECDSA key pair and some string to sign. The 
programme generates signature and saves it into a file 
(signature.bin). Then I check the validity of the signature via the 
following command:


openssl dgst -verify ec_public.pem -signature signature.bin ToSign.txt

the problem is that *my programme sometimes generates wrong 
signature*. 16 times out of 21 the signature produced is invalid and 
the above command outputs:

Error Verifying Data

while in the remaining 5 occurrences it outputs:
Verified OK

Do you have any ideas of how it can be possible? What am I doing wrong?


Here is the programme:

SSL_library_init();
OPENSSL_config(nullptr);
SSL_load_error_strings();
OpenSSL_add_all_algorithms();
ERR_load_BIO_strings();
CRYPTO_set_id_callback(ThreadIdFunction);
CRYPTO_set_locking_callback(LockingFunction);

const TString pk = "-BEGIN EC PRIVATE KEY-\n"
 "MHcCAQEEIG90zmo1o3NWNFa8wp2z4rdQXGSN8xAP/OATLpwlgi+1oAoGCCqGSM49\n"
 "AwEHoUQDQgAE5TwpzBhjUWZoOf629GfwGG5WlRJD7TSuz+ZTHUaiK5mj2qgxBOPk\n"
 "eqOrTYXsiPwnaWe23zHjIM8NOhAm1BiGgA==\n"
                     "-END EC PRIVATE KEY-\n";

const TString ToSign = 
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhc2RmIn0";


EVP_MD_CTX *Ctx    = EVP_MD_CTX_create();
BIO *       Bio    = BIO_new_mem_buf(pk.data(), pk.size());
EVP_PKEY *  EVPKey = PEM_read_bio_PrivateKey(Bio, nullptr, nullptr, 
nullptr);


EVP_DigestSignInit(Ctx, nullptr, EVP_sha256(), nullptr, EVPKey);
EVP_DigestSignUpdate(Ctx, ToSign.data(), ToSign.size());
size_t SignatureLength;
EVP_DigestSignFinal(Ctx, nullptr, &SignatureLength);

TString Result;

^^^ You are treating binary data as a string.
Chances are the TString class will truncate at the first byte with
the value zero, and/or do some other text-specific thing that is bad
for binary data.


Result.resize(SignatureLength);
EVP_DigestSignFinal(Ctx, reinterpret_cast*>(const_cast(Result.data())), &SignatureLength);


// Saving to file...



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


[openssl-users] OpenSSL occasionally generates wrong signature

2018-10-16 Thread Dmitry
Hello!

I have a C++ programme, ECDSA key pair and some string to sign. The
programme generates signature and saves it into a file (signature.bin).
Then I check the validity of the signature via the following command:

openssl dgst -verify ec_public.pem -signature signature.bin ToSign.txt

the problem is that *my programme sometimes generates wrong signature*. 16
times out of 21 the signature produced is invalid and the above command
outputs:
Error Verifying Data

while in the remaining 5 occurrences it outputs:
Verified OK

Do you have any ideas of how it can be possible? What am I doing wrong?


Here is the programme:

SSL_library_init();
OPENSSL_config(nullptr);
SSL_load_error_strings();
OpenSSL_add_all_algorithms();
ERR_load_BIO_strings();
CRYPTO_set_id_callback(ThreadIdFunction);
CRYPTO_set_locking_callback(LockingFunction);

const TString pk = "-BEGIN EC PRIVATE KEY-\n"

 "MHcCAQEEIG90zmo1o3NWNFa8wp2z4rdQXGSN8xAP/OATLpwlgi+1oAoGCCqGSM49\n"

 "AwEHoUQDQgAE5TwpzBhjUWZoOf629GfwGG5WlRJD7TSuz+ZTHUaiK5mj2qgxBOPk\n"
   "eqOrTYXsiPwnaWe23zHjIM8NOhAm1BiGgA==\n"
   "-END EC PRIVATE KEY-\n";

const TString ToSign =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhc2RmIn0";

EVP_MD_CTX *Ctx= EVP_MD_CTX_create();
BIO *   Bio= BIO_new_mem_buf(pk.data(), pk.size());
EVP_PKEY *  EVPKey = PEM_read_bio_PrivateKey(Bio, nullptr, nullptr,
nullptr);

EVP_DigestSignInit(Ctx, nullptr, EVP_sha256(), nullptr, EVPKey);
EVP_DigestSignUpdate(Ctx, ToSign.data(), ToSign.size());
size_t SignatureLength;
EVP_DigestSignFinal(Ctx, nullptr, &SignatureLength);

TString Result;
Result.resize(SignatureLength);
EVP_DigestSignFinal(Ctx, reinterpret_cast(const_cast(Result.data())), &SignatureLength);

// Saving to file...

Thank you in advance
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


Re: [openssl-users] BIO_printf with ASN1_BIT_STRING and ASN1_INTEGER?

2018-10-16 Thread Opa114
Hi,

thanks for this - what about the ASN1_BIT_STRING? Is there such a predefined 
function?


Von: openssl-users  im Auftrag von Dave 
Coombs 
Gesendet: Dienstag, 16. Oktober 2018 15:17 Uhr
An: openssl-users@openssl.org
Betreff: Re: [openssl-users] BIO_printf with ASN1_BIT_STRING and ASN1_INTEGER?

Hi,

You can use i2a_ASN1_INTEGER() to print an ASN1_INTEGER to a BIO.

  -Dave


On Oct 16, 2018, at 05:37, Opa114 mailto:opa...@web.de>> wrote:

Hi there,

i have to print out some data, which is an ASN1_BIT_STRING and an ASN1_INTEGER 
with BIO_printf. For GENERAL_NAME for example there a predefined functions i 
can use like this: GENERAL_NAME_print(bp, GENERAL_NAME_VAR) <= 0

But for ASN1_INTGER and ASN1_BIT_STRING i haven't found any predefined function 
like ASN1_INTEGER_PRINT or something similiar i can use. So can someone tell me 
how i print out these two data types with BIO_printf in the correct and actual 
way?

thanks a lot.
--
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] BIO_printf with ASN1_BIT_STRING and ASN1_INTEGER?

2018-10-16 Thread Matthias Ballreich
Hi,

thanks for this - what about the ASN1_BIT_STRING? Is there such a predefined 
function?

Von: openssl-users  im Auftrag von Dave 
Coombs 
Gesendet: Dienstag, 16. Oktober 2018 15:17 Uhr
An: openssl-users@openssl.org
Betreff: Re: [openssl-users] BIO_printf with ASN1_BIT_STRING and ASN1_INTEGER?

Hi,

You can use i2a_ASN1_INTEGER() to print an ASN1_INTEGER to a BIO.

  -Dave


On Oct 16, 2018, at 05:37, Opa114 mailto:opa...@web.de>> wrote:

Hi there,

i have to print out some data, which is an ASN1_BIT_STRING and an ASN1_INTEGER 
with BIO_printf. For GENERAL_NAME for example there a predefined functions i 
can use like this: GENERAL_NAME_print(bp, GENERAL_NAME_VAR) <= 0

But for ASN1_INTGER and ASN1_BIT_STRING i haven't found any predefined function 
like ASN1_INTEGER_PRINT or something similiar i can use. So can someone tell me 
how i print out these two data types with BIO_printf in the correct and actual 
way?

thanks a lot.
--
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] BIO_printf with ASN1_BIT_STRING and ASN1_INTEGER?

2018-10-16 Thread Dave Coombs
Hi,

You can use i2a_ASN1_INTEGER() to print an ASN1_INTEGER to a BIO.

  -Dave


> On Oct 16, 2018, at 05:37, Opa114  wrote:
> 
> Hi there,
> 
> i have to print out some data, which is an ASN1_BIT_STRING and an 
> ASN1_INTEGER with BIO_printf. For GENERAL_NAME for example there a predefined 
> functions i can use like this: GENERAL_NAME_print(bp, GENERAL_NAME_VAR) <= 0
> 
> But for ASN1_INTGER and ASN1_BIT_STRING i haven't found any predefined 
> function like ASN1_INTEGER_PRINT or something similiar i can use. So can 
> someone tell me how i print out these two data types with BIO_printf in the 
> correct and actual way?
> 
> thanks a lot.
> -- 
> openssl-users mailing list
> To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users 
> 


smime.p7s
Description: S/MIME cryptographic signature
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


[openssl-users] BIO_printf with ASN1_BIT_STRING and ASN1_INTEGER?

2018-10-16 Thread Opa114
Hi there,

i have to print out some data, which is an ASN1_BIT_STRING and an ASN1_INTEGER 
with BIO_printf. For GENERAL_NAME for example there a predefined functions i 
can use like this: GENERAL_NAME_print(bp, GENERAL_NAME_VAR) <= 0

But for ASN1_INTGER and ASN1_BIT_STRING i haven't found any predefined function 
like ASN1_INTEGER_PRINT or something similiar i can use. So can someone tell me 
how i print out these two data types with BIO_printf in the correct and actual 
way?

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


[openssl-users] TLS 1.3 compatibility issues with OpenSSL 1.1.1 prereleases, please stop using them

2018-10-16 Thread Hanno Böck
Hi,

tl;dr If you use OpenSSL 1.1.1_pre* versions please update to the final
version as soon as possible.

Not sure if this has been discussed here before, but I'd like to point
out a mail David Benjamin has recently sent to the TLS WG list:
https://www.ietf.org/mail-archive/web/tls/current/msg27066.html

Particularly he talks about issues the Chrome team had with deploying
TLS 1.3. One of the issues affects OpenSSL prereleases.

Some early versions of OpenSSL 1.1.1 (-pre6 and earlier) would allow
connections from TLS 1.3 clients, but they would try to do a connection
with a Draft TLS 1.3 version with a client that uses the final TLS 1.3
version. This obviously fails.

Long story short: If you happen to use such an OpenSSL pre version
you'll likely have connection issues as more and more software will
support TLS 1.3. So please update as soon as possible.

-- 
Hanno Böck
https://hboeck.de/

mail/jabber: ha...@hboeck.de
GPG: FE73757FA60E4E21B937579FA5880072BBB51E42
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


Re: [openssl-users] openssl ca pkcs11 UI_set_result_ex:result too large:crypto/ui/ui_lib.c:910:You must type in 4 to 32 characters

2018-10-16 Thread Peter Magnusson
Sorry, I am an idiot =)

Problem resolved, user error.  -key was the problem and should not be
used as I showed.

-key has a different meaning for openssl ca than for openssl req, so
my PIN was my -key argument. It got my keyfile from the openssl conf
file.
On Tue, Oct 16, 2018 at 10:23 AM Richard Levitte  wrote:
>
> I'm curious about this error line from the 'openssl ca' output:
>
> > 140735853761408:error:28078064:UI routines:UI_set_result_ex:result too 
> > large:crypto/ui/ui_lib.c:910:You must type in 4 to 32 characters
>
> It should be interesting to try and figure out what pass phrased was
> passed and where it came from.  I'm afraid that's a debugging session.
>
> Cheers,
> Richard
>
> In message 
>  on Tue, 
> 16 Oct 2018 09:54:08 +0200, Peter Magnusson  
> said:
>
> > The error can be workaround by entering PIN = "..." into [pkcs11_section].
> > pkcs11 engine version is libp11-0.4.9.
> > Anyone know if this a 1) libp11 issue or 2) openssl issue or 3) me
> > doing something wrong?
> > On Mon, Oct 15, 2018 at 5:40 PM Peter Magnusson
> >  wrote:
> > >
> > > Hi,
> > >
> > > I'm trying to understand how to make "openssl ca" prompt for a PKCS#11
> > > login pin. Version is openssl-1.1.1.
> > >
> > > openssl req works as I would expect, prompting for PIN:
> > >
> > > YUBIHSM_PKCS11_CONF=yubihsm2-pkcs11.conf \
> > > local-build/bin/openssl \
> > >  req -config yubihsm2-openssl.conf -new \
> > >  -engine pkcs11 -keyform engine -key slot_0-label_ca_key -out
> > > certs.dir/ca.csr.pem
> > > engine "pkcs11" set.
> > > Enter PKCS#11 token PIN for YubiHSM:
> > >
> > > openssl ca I fail to get working, no prompt presented, tried adding
> > > -passin stdin but that has no effect.
> > >
> > > YUBIHSM_PKCS11_CONF=yubihsm2-pkcs11.conf \
> > >  local-build/bin/openssl ca -passin stdin -engine pkcs11 -keyform
> > > engine -key "pkcs11:token=YubiHSM;object=ca_key;type=private" \
> > >  -config yubihsm2-openssl.conf \
> > >  -days 3650 -extensions vpn_server_cert \
> > >  -out server.cert.pem \
> > >  -infiles ../server/certs.dir/server.csr.pem
> > > engine "pkcs11" set.
> > > Using configuration from yubihsm2-openssl.conf
> > > Login failed
> > > Login to token failed, returning NULL...
> > > PKCS11_get_private_key returned NULL
> > > cannot load CA private key from engine
> > > 140735853761408:error:28078064:UI routines:UI_set_result_ex:result too
> > > large:crypto/ui/ui_lib.c:910:You must type in 4 to 32 characters
> > > 140735853761408:error:82074007:PKCS#11 module:pkcs11_login:Invalid
> > > arguments:p11_slot.c:240:
> > > 140735853761408:error:26096080:engine
> > > routines:ENGINE_load_private_key:failed loading private
> > > key:crypto/engine/eng_pkey.c:78:
> > > unable to load CA private key
> > >
> > > Best Regards
> > > //P
> >
> --
> 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] openssl ca pkcs11 UI_set_result_ex:result too large:crypto/ui/ui_lib.c:910:You must type in 4 to 32 characters

2018-10-16 Thread Richard Levitte
I'm curious about this error line from the 'openssl ca' output:

> 140735853761408:error:28078064:UI routines:UI_set_result_ex:result too 
> large:crypto/ui/ui_lib.c:910:You must type in 4 to 32 characters

It should be interesting to try and figure out what pass phrased was
passed and where it came from.  I'm afraid that's a debugging session.

Cheers,
Richard

In message  
on Tue, 16 Oct 2018 09:54:08 +0200, Peter Magnusson 
 said:

> The error can be workaround by entering PIN = "..." into [pkcs11_section].
> pkcs11 engine version is libp11-0.4.9.
> Anyone know if this a 1) libp11 issue or 2) openssl issue or 3) me
> doing something wrong?
> On Mon, Oct 15, 2018 at 5:40 PM Peter Magnusson
>  wrote:
> >
> > Hi,
> >
> > I'm trying to understand how to make "openssl ca" prompt for a PKCS#11
> > login pin. Version is openssl-1.1.1.
> >
> > openssl req works as I would expect, prompting for PIN:
> >
> > YUBIHSM_PKCS11_CONF=yubihsm2-pkcs11.conf \
> > local-build/bin/openssl \
> >  req -config yubihsm2-openssl.conf -new \
> >  -engine pkcs11 -keyform engine -key slot_0-label_ca_key -out
> > certs.dir/ca.csr.pem
> > engine "pkcs11" set.
> > Enter PKCS#11 token PIN for YubiHSM:
> >
> > openssl ca I fail to get working, no prompt presented, tried adding
> > -passin stdin but that has no effect.
> >
> > YUBIHSM_PKCS11_CONF=yubihsm2-pkcs11.conf \
> >  local-build/bin/openssl ca -passin stdin -engine pkcs11 -keyform
> > engine -key "pkcs11:token=YubiHSM;object=ca_key;type=private" \
> >  -config yubihsm2-openssl.conf \
> >  -days 3650 -extensions vpn_server_cert \
> >  -out server.cert.pem \
> >  -infiles ../server/certs.dir/server.csr.pem
> > engine "pkcs11" set.
> > Using configuration from yubihsm2-openssl.conf
> > Login failed
> > Login to token failed, returning NULL...
> > PKCS11_get_private_key returned NULL
> > cannot load CA private key from engine
> > 140735853761408:error:28078064:UI routines:UI_set_result_ex:result too
> > large:crypto/ui/ui_lib.c:910:You must type in 4 to 32 characters
> > 140735853761408:error:82074007:PKCS#11 module:pkcs11_login:Invalid
> > arguments:p11_slot.c:240:
> > 140735853761408:error:26096080:engine
> > routines:ENGINE_load_private_key:failed loading private
> > key:crypto/engine/eng_pkey.c:78:
> > unable to load CA private key
> >
> > Best Regards
> > //P
> 
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


Re: [openssl-users] sendmail, openssl 1.1.1, tls1.3

2018-10-16 Thread Tomas Mraz
On 10/16/2018 09:27 AM, Viktor Dukhovni wrote:
> On Tue, Oct 16, 2018 at 08:13:11AM +0200, Jakob Bohm via openssl-users wrote:
> 
>>> As for the 16K limit, and whether we should be sending client
>>> CA names without further indication from the (TLS 1.3) client
>>> to do so, I'm hoping Matt Caswell and or other team members
>>> will chime in.
>>
>> Just for clarity, how is an OpenSSL 1.1.1 client supposed to tell
>> the local validation code which CAs to trust, especially if loading
>> the list before entering a chroot jail?
> 
> Loading CA files is not a problem in itself, the issue is that some
> (typically server) applications overload the CAfile as also being
> the source of CA hints to clients in certificate requests.  This
> creates bloated server certificate request messages.  With TLS 1.3,
> this is further compounded in applications that are *both* a server
> and client, and use the *same* context for both purposes.  Once
> that happens, the CA hints are used in both directions.

What are the CA hints sent from client to server good for? This looks
like missing API in 1.1.1 as we clearly do not want to start sending
huge client helos just because of client sending the CA hints to servers
in TLS-1.3. This needs to be something that requires an explicit new API
call to set.

> 
>> How is this different from the OpenSSL 1.0.x API?
> 
> The API is identical, what's different is that TLS 1.3 makes the
> CA hints bidirectional, given such hints have never been useful
> before, it is IMHO just needless generality that's counter-productive.
> Perhaps OpenSSL should require an additional non-default configuration
> to enable transmission of the client's CA DNs to the server.
> 
> Or perhaps separate the server->client and client->server CA name
> lists in the SSL context, so that setting one does not (surprise!)
> also set the other.  Overloading the same setting for both directions
> may not have anticipated bidirectional use of contexts.
> 
> Someone should perhaps open an issue to track whether anything needs
> to change here beyond advice to users, and if so what.

I've opened it:

https://github.com/openssl/openssl/issues/7411

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


Re: [openssl-users] openssl ca pkcs11 UI_set_result_ex:result too large:crypto/ui/ui_lib.c:910:You must type in 4 to 32 characters

2018-10-16 Thread Peter Magnusson
The error can be workaround by entering PIN = "..." into [pkcs11_section].
pkcs11 engine version is libp11-0.4.9.
Anyone know if this a 1) libp11 issue or 2) openssl issue or 3) me
doing something wrong?
On Mon, Oct 15, 2018 at 5:40 PM Peter Magnusson
 wrote:
>
> Hi,
>
> I'm trying to understand how to make "openssl ca" prompt for a PKCS#11
> login pin. Version is openssl-1.1.1.
>
> openssl req works as I would expect, prompting for PIN:
>
> YUBIHSM_PKCS11_CONF=yubihsm2-pkcs11.conf \
> local-build/bin/openssl \
>  req -config yubihsm2-openssl.conf -new \
>  -engine pkcs11 -keyform engine -key slot_0-label_ca_key -out
> certs.dir/ca.csr.pem
> engine "pkcs11" set.
> Enter PKCS#11 token PIN for YubiHSM:
>
> openssl ca I fail to get working, no prompt presented, tried adding
> -passin stdin but that has no effect.
>
> YUBIHSM_PKCS11_CONF=yubihsm2-pkcs11.conf \
>  local-build/bin/openssl ca -passin stdin -engine pkcs11 -keyform
> engine -key "pkcs11:token=YubiHSM;object=ca_key;type=private" \
>  -config yubihsm2-openssl.conf \
>  -days 3650 -extensions vpn_server_cert \
>  -out server.cert.pem \
>  -infiles ../server/certs.dir/server.csr.pem
> engine "pkcs11" set.
> Using configuration from yubihsm2-openssl.conf
> Login failed
> Login to token failed, returning NULL...
> PKCS11_get_private_key returned NULL
> cannot load CA private key from engine
> 140735853761408:error:28078064:UI routines:UI_set_result_ex:result too
> large:crypto/ui/ui_lib.c:910:You must type in 4 to 32 characters
> 140735853761408:error:82074007:PKCS#11 module:pkcs11_login:Invalid
> arguments:p11_slot.c:240:
> 140735853761408:error:26096080:engine
> routines:ENGINE_load_private_key:failed loading private
> key:crypto/engine/eng_pkey.c:78:
> unable to load CA private key
>
> Best Regards
> //P
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


Re: [openssl-users] sendmail, openssl 1.1.1, tls1.3

2018-10-16 Thread Viktor Dukhovni
On Tue, Oct 16, 2018 at 08:13:11AM +0200, Jakob Bohm via openssl-users wrote:

> > As for the 16K limit, and whether we should be sending client
> > CA names without further indication from the (TLS 1.3) client
> > to do so, I'm hoping Matt Caswell and or other team members
> > will chime in.
>
> Just for clarity, how is an OpenSSL 1.1.1 client supposed to tell
> the local validation code which CAs to trust, especially if loading
> the list before entering a chroot jail?

Loading CA files is not a problem in itself, the issue is that some
(typically server) applications overload the CAfile as also being
the source of CA hints to clients in certificate requests.  This
creates bloated server certificate request messages.  With TLS 1.3,
this is further compounded in applications that are *both* a server
and client, and use the *same* context for both purposes.  Once
that happens, the CA hints are used in both directions.

> How is this different from the OpenSSL 1.0.x API?

The API is identical, what's different is that TLS 1.3 makes the
CA hints bidirectional, given such hints have never been useful
before, it is IMHO just needless generality that's counter-productive.
Perhaps OpenSSL should require an additional non-default configuration
to enable transmission of the client's CA DNs to the server.

Or perhaps separate the server->client and client->server CA name
lists in the SSL context, so that setting one does not (surprise!)
also set the other.  Overloading the same setting for both directions
may not have anticipated bidirectional use of contexts.

Someone should perhaps open an issue to track whether anything needs
to change here beyond advice to users, and if so what.

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