summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjmc <>2010-10-09 10:03:44 +0000
committerjmc <>2010-10-09 10:03:44 +0000
commitc11440122a12473ff58c3ec76b88db05c3c6733a (patch)
treed48d92d43fe631d980e36f232bc6ae15925d8107 /src
parent0b0e628f61a7b75e8bb9281c592e1a4da79a0586 (diff)
downloadopenbsd-c11440122a12473ff58c3ec76b88db05c3c6733a.tar.gz
openbsd-c11440122a12473ff58c3ec76b88db05c3c6733a.tar.bz2
openbsd-c11440122a12473ff58c3ec76b88db05c3c6733a.zip
document "openssl genpkey";
Diffstat (limited to 'src')
-rw-r--r--src/usr.sbin/openssl/openssl.1178
1 files changed, 176 insertions, 2 deletions
diff --git a/src/usr.sbin/openssl/openssl.1 b/src/usr.sbin/openssl/openssl.1
index bc3f26f500..386699c6ff 100644
--- a/src/usr.sbin/openssl/openssl.1
+++ b/src/usr.sbin/openssl/openssl.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: openssl.1,v 1.72 2010/10/08 19:18:41 jmc Exp $ 1.\" $OpenBSD: openssl.1,v 1.73 2010/10/09 10:03:44 jmc Exp $
2.\" ==================================================================== 2.\" ====================================================================
3.\" Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 3.\" Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
4.\" 4.\"
@@ -112,7 +112,7 @@
112.\" 112.\"
113.\" OPENSSL 113.\" OPENSSL
114.\" 114.\"
115.Dd $Mdocdate: October 8 2010 $ 115.Dd $Mdocdate: October 9 2010 $
116.Dt OPENSSL 1 116.Dt OPENSSL 1
117.Os 117.Os
118.Sh NAME 118.Sh NAME
@@ -298,6 +298,8 @@ Superseded by
298.Cm genpkey 298.Cm genpkey
299and 299and
300.Cm pkey . 300.Cm pkey .
301.It Cm genpkey
302Generation of private keys or parameters.
301.It Cm genrsa 303.It Cm genrsa
302Generation of RSA private key. 304Generation of RSA private key.
303Superseded by 305Superseded by
@@ -3410,6 +3412,178 @@ Multiple files can be specified separated by a
3410DSA key generation is little more than random number generation so it is 3412DSA key generation is little more than random number generation so it is
3411much quicker than RSA key generation, for example. 3413much quicker than RSA key generation, for example.
3412.\" 3414.\"
3415.\" GENPKEY
3416.\"
3417.Sh GENPKEY
3418.Nm openssl genpkey
3419.Bk -words
3420.Op Ar cipher
3421.Op Fl genparam
3422.Op Fl pass Ar arg
3423.Op Fl text
3424.Op Fl algorithm Ar alg
3425.Op Fl engine Ar id
3426.Op Fl out Ar filename
3427.Op Fl outform Ar DER | PEM
3428.Op Fl paramfile Ar file
3429.Op Fl pkeyopt Ar opt : Ns Ar value
3430.Ek
3431.Pp
3432The
3433.Nm genpkey
3434command generates private keys.
3435The use of this
3436program is encouraged over the algorithm specific utilities
3437because additional algorithm options
3438and engine-provided algorithms can be used.
3439.Pp
3440The options are as follows:
3441.Bl -tag -width Ds
3442.It Fl algorithm Ar alg
3443The public key algorithm to use,
3444such as RSA, DSA, or DH.
3445If used this option must precede any
3446.Fl pkeyopt
3447options.
3448The options
3449.Fl paramfile
3450and
3451.Fl algorithm
3452are mutually exclusive.
3453.It Ar cipher
3454Encrypt the private key with the supplied cipher.
3455Any algorithm name accepted by
3456.Fn EVP_get_cipherbyname
3457is acceptable, such as
3458.Cm des3 .
3459.It Fl engine Ar id
3460Specifying an engine (by its unique
3461.Ar id
3462string) will cause
3463.Nm genpkey
3464to attempt to obtain a functional reference to the specified engine,
3465thus initialising it if needed.
3466The engine will then be set as the default
3467for all available algorithms.
3468.It Fl genparam
3469Generate a set of parameters instead of a private key.
3470If used this option must precede any
3471.Fl algorithm ,
3472.Fl paramfile ,
3473or
3474.Fl pkeyopt
3475options.
3476.It Fl out Ar filename
3477The output filename.
3478If this argument is not specified then standard output is used.
3479.It Fl outform Ar DER | PEM
3480This specifies the output format, DER or PEM.
3481.It Fl paramfile Ar file
3482Some public key algorithms generate a private key based on a set of parameters.
3483They can be supplied using this option.
3484If this option is used the public key
3485algorithm used is determined by the parameters.
3486If used this option must precede any
3487.Fl pkeyopt
3488options.
3489The options
3490.Fl paramfile
3491and
3492.Fl algorithm
3493are mutually exclusive.
3494.It Fl pass Ar arg
3495The output file password source.
3496For more information about the format of
3497.Ar arg
3498see the
3499.Sx PASS PHRASE ARGUMENTS
3500section above.
3501.It Fl pkeyopt Ar opt : Ns Ar value
3502Set the public key algorithm option
3503.Ar opt
3504to
3505.Ar value .
3506The precise set of options supported
3507depends on the public key algorithm used and its implementation.
3508See
3509.Sx GENPKEY KEY GENERATION OPTIONS
3510below for more details.
3511.It Fl text
3512Print an (unencrypted) text representation of private and public keys and
3513parameters along with the DER or PEM structure.
3514.El
3515.Sh GENPKEY KEY GENERATION OPTIONS
3516The options supported by each algorithm
3517and indeed each implementation of an algorithm can vary.
3518The options for the
3519.Nm OpenSSL
3520implementations are detailed below.
3521.Bl -tag -width Ds -offset indent
3522.It rsa_keygen_bits : Ns Ar numbits
3523(RSA)
3524The number of bits in the generated key.
3525If not specified 1024 is used.
3526.It rsa_keygen_pubexp : Ns Ar value
3527(RSA)
3528The RSA public exponent value.
3529This can be a large decimal or hexadecimal value if preceded by 0x.
3530The default value is 65537.
3531.It dsa_paramgen_bits : Ns Ar numbits
3532(DSA)
3533The number of bits in the generated parameters.
3534If not specified 1024 is used.
3535.It dh_paramgen_prime_len : Ns Ar numbits
3536(DH)
3537The number of bits in the prime parameter
3538.Ar p .
3539.It dh_paramgen_generator : Ns Ar value
3540(DH)
3541The value to use for the generator
3542.Ar g .
3543.It ec_paramgen_curve : Ns Ar curve
3544(EC)
3545The EC curve to use.
3546.El
3547.Sh GENPKEY EXAMPLES
3548Generate an RSA private key using default parameters:
3549.Bd -literal -offset indent
3550$ openssl genpkey -algorithm RSA -out key.pem
3551.Ed
3552.Pp
3553Encrypt and output a private key using 128-bit AES and the passphrase "hello":
3554.Bd -literal -offset indent
3555$ openssl genpkey -algorithm RSA -out key.pem \e
3556 -aes-128-cbc -pass pass:hello
3557.Ed
3558.Pp
3559Generate a 2048-bit RSA key using 3 as the public exponent:
3560.Bd -literal -offset indent
3561$ openssl genpkey -algorithm RSA -out key.pem \e
3562 -pkeyopt rsa_keygen_bits:2048 -pkeyopt rsa_keygen_pubexp:3
3563.Ed
3564.Pp
3565Generate 1024-bit DSA parameters:
3566.Bd -literal -offset indent
3567$ openssl genpkey -genparam -algorithm DSA \e
3568 -out dsap.pem -pkeyopt dsa_paramgen_bits:1024
3569.Ed
3570.Pp
3571Generate a DSA key from parameters:
3572.Bd -literal -offset indent
3573$ openssl genpkey -paramfile dsap.pem -out dsakey.pem
3574.Ed
3575.Pp
3576Generate 1024-bit DH parameters:
3577.Bd -literal -offset indent
3578$ openssl genpkey -genparam -algorithm DH \e
3579 -out dhp.pem -pkeyopt dh_paramgen_prime_len:1024
3580.Ed
3581.Pp
3582Generate a DH key from parameters:
3583.Bd -literal -offset indent
3584$ openssl genpkey -paramfile dhp.pem -out dhkey.pem
3585.Ed
3586.\"
3413.\" GENRSA 3587.\" GENRSA
3414.\" 3588.\"
3415.Sh GENRSA 3589.Sh GENRSA