Message-ID: <5436B50A.7040004@...1227...> Date: Thu, 09 Oct 2014 18:17:14 +0200 From: Arne Schwabe MIME-Version: 1.0 References: <5433CFD5.5060901@...515...> <5433FD92.7020400@...1227...> <5436B36A.1050105@...1147...> In-Reply-To: <5436B36A.1050105@...1147...> Content-Type: multipart/alternative; boundary="------------020209040602060102060901" Subject: Re: [Openvpn-devel] Paid Engagement List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Just Keijser Cc: openvpn-devel This is a multi-part message in MIME format. --------------020209040602060102060901 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit > > So, it looks like running rsa_sign with a cert/key pair coming out of > the cryptostore store is causing some low level openssl problems. > Don't know how easy it is fix, but most likely it's not inside the > OpenVPN code... > Pretty easy (for OpenSSL standards...). You have to use the lowlevel functions instead of rsa_sign. See also https://code.google.com/p/ics-openvpn/source/browse/main/jni/jbcrypto.cpp Basically for ics-openvpn the change was to replace RSA_sign(NID_md5_sha1, (unsigned char*) data, datalen, sigret, &siglen, pkey->pkey.rsa) <= 0 ) with siglen = RSA_private_encrypt(datalen,(unsigned char*) data,sigret,pkey->pkey.rsa,RSA_PKCS1_PADDING); But I haven't looked at the OpenVPN source code yet which code path is called there. Arne --------------020209040602060102060901 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit

So, it looks like running rsa_sign with a cert/key pair coming out of the cryptostore store is causing some low level openssl problems. Don't know how easy it is fix, but most likely it's not inside the OpenVPN code...

Pretty easy (for OpenSSL standards...). You have to use the lowlevel functions instead of rsa_sign. See also https://code.google.com/p/ics-openvpn/source/browse/main/jni/jbcrypto.cpp

Basically for ics-openvpn the change was to replace

RSA_sign(NID_md5_sha1, (unsigned char*) data, datalen,
        sigret, &siglen, pkey->pkey.rsa) <= 0 )

with

    siglen = RSA_private_encrypt(datalen,(unsigned char*) data,sigret,pkey->pkey.rsa,RSA_PKCS1_PADDING);

But I haven't looked at the OpenVPN source code yet which code path is called there.

Arne
--------------020209040602060102060901--