Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSL ASN1 Encoding routines and x509 certificate routine errors

I'm completely new to anything Secure Socket Layer related up until yesterday evening and today. I need to get a self-signed certificate to proceed with an app registration process so that I can implement OAuth in an app I'm writint. I went through a nice tutorial about how to generate certificates here. I'm an ubuntu user, if you didn't click the link to figure that out. I've been trying to generate a self-signed 1024 bit RSA key encoded x.509 certificate in PEM format. After setting up the configuration and doing everything as is on the tutorial (of course with the exception of specifying the environment-related data to my own environment). The commands to generate a new certificate and key after going through the configuration are:

forces SSL to look for configuration file in alternate location (the server configuration file):

export OPENSSL_CONF=~/myCA/exampleserver.cnf

Generate the certificate and key:

openssl req -newkey rsa:1024 -keyout tempkey.pem -keyform PEM -out tempreq.pem -outform     PEM

Following those two commands the following is displayed:

Generating a 1024 bit RSA private key
...++++++
...............++++++
writing new private key to 'tempkey.pem'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----

I enter my pass phrase and the error I continually get is:

problems making Certificate Request
3074111688:error:0D06407A:asn1 encoding routines:a2d_ASN1_OBJECT:first num too      large:a_object.c:109:
3074111688:error:0B083077:x509 certificate    routines:X509_NAME_ENTRY_create_by_txt:invalid field name:x509name.c:285:name=organizationUnitName
like image 594
madman2890 Avatar asked Feb 04 '13 02:02

madman2890


2 Answers

I ran into a similar problem while following the same tutorial that you mentioned. In my case, the error was:

problems making Certificate Request
140098671105696:error:0D07A097:asn1 encoding routines:ASN1_mbstring_ncopy:string too long:a_mbstr.c:154:maxsize=2

So I figured out that I've written some string which should have been 2 characters long (maxsize=2), but happened way longer. I returned back to my config file and quickly found that I've wrote the long name of the country, instead of the 2-character code. This solved my problem.

like image 104
Maxim Chetrusca Avatar answered Nov 06 '22 17:11

Maxim Chetrusca


not really familiar with the process but, it appears "invalid field name:x509name.c:285:name=organizationUnitName" means your Organization Unit Name is invalid.

According to digicert.com: The Organizational Unit is whichever branch of your company is ordering the certificate such as accounting, marketing, etc.

like image 2
Adam Gamble Avatar answered Nov 06 '22 19:11

Adam Gamble