Skip to content

Commit

Permalink
New functions and option to use NEW in certificate requests.
Browse files Browse the repository at this point in the history
  • Loading branch information
snhenson committed Feb 18, 2000
1 parent 5c2ec54 commit 8a208cb
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

Changes between 0.9.4 and 0.9.5 [xx XXX 2000]

*) Add some PEM_write_X509_REQ_NEW() functions and a command line
argument to 'req'. This is not because the function is newer or
better than others it just uses the work 'NEW' in the certificate
request header lines. Some software needs this.
[Steve Henson]

*) Reorganise password command line arguments: now passwords can be
obtained from various sources. Delete the PEM_cb function and make
it the default behaviour: i.e. if the callback is NULL and the
Expand Down
12 changes: 8 additions & 4 deletions apps/req.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ int MAIN(int argc, char **argv)
int i,badops=0,newreq=0,newkey= -1,pkey_type=0;
BIO *in=NULL,*out=NULL;
int informat,outformat,verify=0,noout=0,text=0,keyform=FORMAT_PEM;
int nodes=0,kludge=0;
int nodes=0,kludge=0,newhdr=0;
char *infile,*outfile,*prog,*keyfile=NULL,*template=NULL,*keyout=NULL;
char *extensions = NULL;
char *req_exts = NULL;
Expand Down Expand Up @@ -306,6 +306,8 @@ int MAIN(int argc, char **argv)

newreq=1;
}
else if (strcmp(*argv,"-newhdr") == 0)
newhdr=1;
else if (strcmp(*argv,"-modulus") == 0)
modulus=1;
else if (strcmp(*argv,"-verify") == 0)
Expand Down Expand Up @@ -378,6 +380,7 @@ int MAIN(int argc, char **argv)
BIO_printf(bio_err," -new new request.\n");
BIO_printf(bio_err," -x509 output a x509 structure instead of a cert. req.\n");
BIO_printf(bio_err," -days number of days a x509 generated by -x509 is valid for.\n");
BIO_printf(bio_err," -newhdr output \"NEW\" in the header lines\n");
BIO_printf(bio_err," -asn1-kludge Output the 'request' in a format that is wrong but some CA's\n");
BIO_printf(bio_err," have been reported as requiring\n");
BIO_printf(bio_err," -extensions .. specify certificate extension section (override value in config file)\n");
Expand Down Expand Up @@ -834,9 +837,10 @@ int MAIN(int argc, char **argv)
{
if (outformat == FORMAT_ASN1)
i=i2d_X509_REQ_bio(out,req);
else if (outformat == FORMAT_PEM)
i=PEM_write_bio_X509_REQ(out,req);
else {
else if (outformat == FORMAT_PEM) {
if(newhdr) i=PEM_write_bio_X509_REQ_NEW(out,req);
else i=PEM_write_bio_X509_REQ(out,req);
} else {
BIO_printf(bio_err,"bad output format specified for outfile\n");
goto end;
}
Expand Down
1 change: 1 addition & 0 deletions crypto/pem/pem.h
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ DECLARE_PEM_rw(X509, X509)
DECLARE_PEM_rw(X509_AUX, X509)

DECLARE_PEM_rw(X509_REQ, X509_REQ)
DECLARE_PEM_write(X509_REQ_NEW, X509_REQ)

DECLARE_PEM_rw(X509_CRL, X509_CRL)

Expand Down
2 changes: 2 additions & 0 deletions crypto/pem/pem_all.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ IMPLEMENT_PEM_rw(X509_AUX, X509, PEM_STRING_X509_TRUSTED, X509_AUX)

IMPLEMENT_PEM_rw(X509_REQ, X509_REQ, PEM_STRING_X509_REQ, X509_REQ)

IMPLEMENT_PEM_write(X509_REQ_NEW, X509_REQ, PEM_STRING_X509_REQ_OLD, X509_REQ)

IMPLEMENT_PEM_rw(X509_CRL, X509_CRL, PEM_STRING_X509_CRL, X509_CRL)

IMPLEMENT_PEM_rw(PKCS7, PKCS7, PEM_STRING_PKCS7, PKCS7)
Expand Down
22 changes: 14 additions & 8 deletions doc/apps/req.pod
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ B<openssl> B<req>
[B<-config filename>]
[B<-x509>]
[B<-days n>]
[B<-noasn1-kludge>]
[B<-asn1-kludge>]
[B<-newhdr>]
[B<-extensions section>]
[B<-reqexts section>]

Expand Down Expand Up @@ -180,6 +181,11 @@ B<SET OF> whereas the correct form does.

It should be noted that very few CAs still require the use of this option.

=item B<-newhdr>

Adds the word B<NEW> to the PEM file header and footer lines on the outputed
request. Some software (Netscape certificate server) and some CAs need this.

=back

=head1 CONFIGURATION FILE FORMAT
Expand Down Expand Up @@ -302,9 +308,9 @@ just consist of field names and values: for example,

This allows external programs (e.g. GUI based) to generate a template file
with all the field names and values and just pass it to B<req>. An example
of this kind of configuration files is contained in the B<EXAMPLES> section.
of this kind of configuration file is contained in the B<EXAMPLES> section.

Alternatively if the B<prompt> option is absent or not set to B<no> the the
Alternatively if the B<prompt> option is absent or not set to B<no> then the
file contains field prompting information. It consists of lines of the form:

fieldName="prompt"
Expand All @@ -327,16 +333,15 @@ two characters long and must fit in a PrintableString).
Some fields (such as organizationName) can be used more than once
in a DN. This presents a problem because configuration files will
not recognize the same name occurring twice. To avoid this problem
if the fieldName contains an some characters followed by a full stop
if the fieldName contains some characters followed by a full stop
they will be ignored. So for example a second organizationName can
be input by calling it "1.organizationName".

The actual permitted field names are any object identifier short or
long names. These are compiled into OpenSSL and include the usual
values such as commonName, countryName, localityName, organizationName,
organizationUnitName, stateOrPrivinceName. Additionally emailAddress
is include as well as name, surname, givenName initials and dnQualifier
are supported.
is include as well as name, surname, givenName initials and dnQualifier.

Additional object identifiers can be defined with the B<oid_file> or
B<oid_section> options in the configuration file. Any additional fields
Expand Down Expand Up @@ -439,7 +444,7 @@ Sample configuration containing all field values:

=head1 NOTES

The header and footer lines in the B<PEM> format are respectively:
The header and footer lines in the B<PEM> format are normally:

-----BEGIN CERTIFICATE REQUEST----
-----END CERTIFICATE REQUEST----
Expand All @@ -449,7 +454,8 @@ some software (some versions of Netscape certificate server) instead needs:
-----BEGIN NEW CERTIFICATE REQUEST----
-----END NEW CERTIFICATE REQUEST----

but is otherwise compatible. Either form is accepted on input.
which is produced with the B<-newhdr> option but is otherwise compatible.
Either form is accepted transparently on input.

The certificate requests generated by B<Xenroll> with MSIE have extensions
added. It includes the B<keyUsage> extension which determines the type of
Expand Down
2 changes: 2 additions & 0 deletions util/libeay.num
Original file line number Diff line number Diff line change
Expand Up @@ -2222,3 +2222,5 @@ CRYPTO_dbg_get_options 2246
AUTHORITY_INFO_ACCESS_new 2247
CRYPTO_get_mem_debug_options 2248
des_crypt 2249
PEM_write_bio_X509_REQ_NEW 2250
PEM_write_X509_REQ_NEW 2251
12 changes: 12 additions & 0 deletions util/mkdef.pl
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,18 @@ sub do_defs
}
$funcs{"PEM_read_bio_${1}"} = 1;
$funcs{"PEM_write_bio_${1}"} = 1;
} elsif (/^DECLARE_PEM_write\s*\(\s*(\w*)\s*,/ ||
/^DECLARE_PEM_write_cb\s*\(\s*(\w*)\s*,/ ) {
if($W32) {
$funcs{"PEM_write_${1}"} = 1;
}
$funcs{"PEM_write_bio_${1}"} = 1;
} elsif (/^DECLARE_PEM_read\s*\(\s*(\w*)\s*,/ ||
/^DECLARE_PEM_read_cb\s*\(\s*(\w*)\s*,/ ) {
if($W32) {
$funcs{"PEM_read_${1}"} = 1;
}
$funcs{"PEM_read_bio_${1}"} = 1;
} elsif (
($tag{'TRUE'} != -1) &&
($tag{'FreeBSD'} != 1) &&
Expand Down

0 comments on commit 8a208cb

Please sign in to comment.