summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/usr.bin/openssl/openssl.1165
1 files changed, 13 insertions, 152 deletions
diff --git a/src/usr.bin/openssl/openssl.1 b/src/usr.bin/openssl/openssl.1
index f804dcef83..e4732394d0 100644
--- a/src/usr.bin/openssl/openssl.1
+++ b/src/usr.bin/openssl/openssl.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: openssl.1,v 1.64 2016/08/28 19:34:15 jmc Exp $ 1.\" $OpenBSD: openssl.1,v 1.65 2016/08/30 07:53:59 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: August 28 2016 $ 115.Dd $Mdocdate: August 30 2016 $
116.Dt OPENSSL 1 116.Dt OPENSSL 1
117.Os 117.Os
118.Sh NAME 118.Sh NAME
@@ -3469,36 +3469,6 @@ or
3469options in the configuration file. 3469options in the configuration file.
3470Any additional fields will be treated as though they were a 3470Any additional fields will be treated as though they were a
3471.Cm DirectoryString . 3471.Cm DirectoryString .
3472.Pp
3473The following messages are frequently asked about:
3474.Bd -unfilled -offset indent
3475Using configuration from /some/path/openssl.cnf
3476Unable to load config info
3477\&...
3478unable to find 'distinguished_name' in config
3479problems making Certificate Request
3480.Ed
3481.Pp
3482In this case it can't find the configuration file!
3483.Pp
3484Another puzzling message is:
3485.Bd -unfilled -offset indent
3486Attributes:
3487 a0:00
3488.Ed
3489.Pp
3490This is displayed when no attributes are present and the request includes
3491the correct empty SET OF structure
3492(the DER encoding of which is 0xa0 0x00).
3493If the message is instead:
3494.Pp
3495.D1 Attributes:
3496.Pp
3497then the SET OF is missing and the encoding is technically invalid
3498(but it is tolerated).
3499See the description
3500.Fl asn1-kludge
3501for more information.
3502.Sh RSA 3472.Sh RSA
3503.nr nS 1 3473.nr nS 1
3504.Nm "openssl rsa" 3474.Nm "openssl rsa"
@@ -3577,13 +3547,9 @@ and SGC keys.
3577.It Fl text 3547.It Fl text
3578Print the public/private key components in plain text. 3548Print the public/private key components in plain text.
3579.El 3549.El
3580.\"
3581.\" RSAUTL
3582.\"
3583.Sh RSAUTL 3550.Sh RSAUTL
3584.nr nS 1 3551.nr nS 1
3585.Nm "openssl rsautl" 3552.Nm "openssl rsautl"
3586.Bk -words
3587.Op Fl asn1parse 3553.Op Fl asn1parse
3588.Op Fl certin 3554.Op Fl certin
3589.Op Fl decrypt 3555.Op Fl decrypt
@@ -3591,13 +3557,12 @@ Print the public/private key components in plain text.
3591.Op Fl hexdump 3557.Op Fl hexdump
3592.Op Fl in Ar file 3558.Op Fl in Ar file
3593.Op Fl inkey Ar file 3559.Op Fl inkey Ar file
3594.Op Fl keyform Ar DER | PEM 3560.Op Fl keyform Cm der | pem
3595.Op Fl oaep | pkcs | raw | ssl 3561.Op Fl oaep | pkcs | raw | ssl
3596.Op Fl out Ar file 3562.Op Fl out Ar file
3597.Op Fl pubin 3563.Op Fl pubin
3598.Op Fl sign 3564.Op Fl sign
3599.Op Fl verify 3565.Op Fl verify
3600.Ek
3601.nr nS 0 3566.nr nS 0
3602.Pp 3567.Pp
3603The 3568The
@@ -3620,31 +3585,25 @@ Encrypt the input data using an RSA public key.
3620.It Fl hexdump 3585.It Fl hexdump
3621Hex dump the output data. 3586Hex dump the output data.
3622.It Fl in Ar file 3587.It Fl in Ar file
3623This specifies the input 3588The input to read from,
3624.Ar file 3589or standard input if not specified.
3625to read data from, or standard input
3626if this option is not specified.
3627.It Fl inkey Ar file 3590.It Fl inkey Ar file
3628The input key file, by default it should be an RSA private key. 3591The input key file; by default an RSA private key.
3629.It Fl keyform Ar DER | PEM 3592.It Fl keyform Cm der | pem
3630Private ket format. 3593The private ket format.
3631Default is 3594The default is
3632.Ar PEM . 3595.Cm pem .
3633.It Fl oaep | pkcs | raw | ssl 3596.It Fl oaep | pkcs | raw | ssl
3634The padding to use: 3597The padding to use:
3635PKCS#1 OAEP, PKCS#1 v1.5 3598PKCS#1 OAEP, PKCS#1 v1.5 (the default), or no padding, respectively.
3636.Pq the default ,
3637or no padding, respectively.
3638For signatures, only 3599For signatures, only
3639.Fl pkcs 3600.Fl pkcs
3640and 3601and
3641.Fl raw 3602.Fl raw
3642can be used. 3603can be used.
3643.It Fl out Ar file 3604.It Fl out Ar file
3644Specifies the output 3605The output file to write to,
3645.Ar file 3606or standard output if not specified.
3646to write to, or standard output by
3647default.
3648.It Fl pubin 3607.It Fl pubin
3649The input file is an RSA public key. 3608The input file is an RSA public key.
3650.It Fl sign 3609.It Fl sign
@@ -3653,104 +3612,6 @@ This requires an RSA private key.
3653.It Fl verify 3612.It Fl verify
3654Verify the input data and output the recovered data. 3613Verify the input data and output the recovered data.
3655.El 3614.El
3656.Sh RSAUTL NOTES
3657.Nm rsautl ,
3658because it uses the RSA algorithm directly, can only be
3659used to sign or verify small pieces of data.
3660.Sh RSAUTL EXAMPLES
3661Sign some data using a private key:
3662.Pp
3663.Dl "$ openssl rsautl -sign -in file -inkey key.pem -out sig"
3664.Pp
3665Recover the signed data:
3666.Pp
3667.Dl $ openssl rsautl -verify -in sig -inkey key.pem
3668.Pp
3669Examine the raw signed data:
3670.Pp
3671.Li "\ \&$ openssl rsautl -verify -in file -inkey key.pem -raw -hexdump"
3672.Bd -unfilled
3673\& 0000 - 00 01 ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................
3674\& 0010 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................
3675\& 0020 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................
3676\& 0030 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................
3677\& 0040 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................
3678\& 0050 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................
3679\& 0060 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................
3680\& 0070 - ff ff ff ff 00 68 65 6c-6c 6f 20 77 6f 72 6c 64 .....hello world
3681.Ed
3682.Pp
3683The PKCS#1 block formatting is evident from this.
3684If this was done using encrypt and decrypt, the block would have been of type 2
3685.Pq the second byte
3686and random padding data visible instead of the 0xff bytes.
3687.Pp
3688It is possible to analyse the signature of certificates using this
3689utility in conjunction with
3690.Nm asn1parse .
3691Consider the self-signed example in
3692.Pa certs/pca-cert.pem :
3693running
3694.Nm asn1parse
3695as follows yields:
3696.Pp
3697.Li "\ \&$ openssl asn1parse -in pca-cert.pem"
3698.Bd -unfilled
3699\& 0:d=0 hl=4 l= 742 cons: SEQUENCE
3700\& 4:d=1 hl=4 l= 591 cons: SEQUENCE
3701\& 8:d=2 hl=2 l= 3 cons: cont [ 0 ]
3702\& 10:d=3 hl=2 l= 1 prim: INTEGER :02
3703\& 13:d=2 hl=2 l= 1 prim: INTEGER :00
3704\& 16:d=2 hl=2 l= 13 cons: SEQUENCE
3705\& 18:d=3 hl=2 l= 9 prim: OBJECT :md5WithRSAEncryption
3706\& 29:d=3 hl=2 l= 0 prim: NULL
3707\& 31:d=2 hl=2 l= 92 cons: SEQUENCE
3708\& 33:d=3 hl=2 l= 11 cons: SET
3709\& 35:d=4 hl=2 l= 9 cons: SEQUENCE
3710\& 37:d=5 hl=2 l= 3 prim: OBJECT :countryName
3711\& 42:d=5 hl=2 l= 2 prim: PRINTABLESTRING :AU
3712\& ....
3713\& 599:d=1 hl=2 l= 13 cons: SEQUENCE
3714\& 601:d=2 hl=2 l= 9 prim: OBJECT :md5WithRSAEncryption
3715\& 612:d=2 hl=2 l= 0 prim: NULL
3716\& 614:d=1 hl=3 l= 129 prim: BIT STRING
3717.Ed
3718.Pp
3719The final BIT STRING contains the actual signature.
3720It can be extracted with:
3721.Pp
3722.Dl "$ openssl asn1parse -in pca-cert.pem -out sig -noout -strparse 614"
3723.Pp
3724The certificate public key can be extracted with:
3725.Pp
3726.Dl $ openssl x509 -in test/testx509.pem -pubkey -noout \*(Gtpubkey.pem
3727.Pp
3728The signature can be analysed with:
3729.Pp
3730.Li "\ \&$ openssl rsautl -in sig -verify -asn1parse -inkey pubkey.pem -pubin"
3731.Bd -unfilled
3732\& 0:d=0 hl=2 l= 32 cons: SEQUENCE
3733\& 2:d=1 hl=2 l= 12 cons: SEQUENCE
3734\& 4:d=2 hl=2 l= 8 prim: OBJECT :md5
3735\& 14:d=2 hl=2 l= 0 prim: NULL
3736\& 16:d=1 hl=2 l= 16 prim: OCTET STRING
3737\& 0000 - f3 46 9e aa 1a 4a 73 c9-37 ea 93 00 48 25 08 b5 .F...Js.7...H%..
3738.Ed
3739.Pp
3740This is the parsed version of an ASN1
3741.Em DigestInfo
3742structure.
3743It can be seen that the digest used was MD5.
3744The actual part of the certificate that was signed can be extracted with:
3745.Pp
3746.Dl "$ openssl asn1parse -in pca-cert.pem -out tbs -noout -strparse 4"
3747.Pp
3748and its digest computed with:
3749.Pp
3750.Dl $ openssl md5 -c tbs
3751.D1 MD5(tbs)= f3:46:9e:aa:1a:4a:73:c9:37:ea:93:00:48:25:08:b5
3752.Pp
3753which it can be seen agrees with the recovered value above.
3754.\" 3615.\"
3755.\" S_CLIENT 3616.\" S_CLIENT
3756.\" 3617.\"