diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/usr.bin/openssl/openssl.1 | 165 |
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 | |||
3469 | options in the configuration file. | 3469 | options in the configuration file. |
3470 | Any additional fields will be treated as though they were a | 3470 | Any additional fields will be treated as though they were a |
3471 | .Cm DirectoryString . | 3471 | .Cm DirectoryString . |
3472 | .Pp | ||
3473 | The following messages are frequently asked about: | ||
3474 | .Bd -unfilled -offset indent | ||
3475 | Using configuration from /some/path/openssl.cnf | ||
3476 | Unable to load config info | ||
3477 | \&... | ||
3478 | unable to find 'distinguished_name' in config | ||
3479 | problems making Certificate Request | ||
3480 | .Ed | ||
3481 | .Pp | ||
3482 | In this case it can't find the configuration file! | ||
3483 | .Pp | ||
3484 | Another puzzling message is: | ||
3485 | .Bd -unfilled -offset indent | ||
3486 | Attributes: | ||
3487 | a0:00 | ||
3488 | .Ed | ||
3489 | .Pp | ||
3490 | This is displayed when no attributes are present and the request includes | ||
3491 | the correct empty SET OF structure | ||
3492 | (the DER encoding of which is 0xa0 0x00). | ||
3493 | If the message is instead: | ||
3494 | .Pp | ||
3495 | .D1 Attributes: | ||
3496 | .Pp | ||
3497 | then the SET OF is missing and the encoding is technically invalid | ||
3498 | (but it is tolerated). | ||
3499 | See the description | ||
3500 | .Fl asn1-kludge | ||
3501 | for 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 |
3578 | Print the public/private key components in plain text. | 3548 | Print 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 |
3603 | The | 3568 | The |
@@ -3620,31 +3585,25 @@ Encrypt the input data using an RSA public key. | |||
3620 | .It Fl hexdump | 3585 | .It Fl hexdump |
3621 | Hex dump the output data. | 3586 | Hex dump the output data. |
3622 | .It Fl in Ar file | 3587 | .It Fl in Ar file |
3623 | This specifies the input | 3588 | The input to read from, |
3624 | .Ar file | 3589 | or standard input if not specified. |
3625 | to read data from, or standard input | ||
3626 | if this option is not specified. | ||
3627 | .It Fl inkey Ar file | 3590 | .It Fl inkey Ar file |
3628 | The input key file, by default it should be an RSA private key. | 3591 | The input key file; by default an RSA private key. |
3629 | .It Fl keyform Ar DER | PEM | 3592 | .It Fl keyform Cm der | pem |
3630 | Private ket format. | 3593 | The private ket format. |
3631 | Default is | 3594 | The default is |
3632 | .Ar PEM . | 3595 | .Cm pem . |
3633 | .It Fl oaep | pkcs | raw | ssl | 3596 | .It Fl oaep | pkcs | raw | ssl |
3634 | The padding to use: | 3597 | The padding to use: |
3635 | PKCS#1 OAEP, PKCS#1 v1.5 | 3598 | PKCS#1 OAEP, PKCS#1 v1.5 (the default), or no padding, respectively. |
3636 | .Pq the default , | ||
3637 | or no padding, respectively. | ||
3638 | For signatures, only | 3599 | For signatures, only |
3639 | .Fl pkcs | 3600 | .Fl pkcs |
3640 | and | 3601 | and |
3641 | .Fl raw | 3602 | .Fl raw |
3642 | can be used. | 3603 | can be used. |
3643 | .It Fl out Ar file | 3604 | .It Fl out Ar file |
3644 | Specifies the output | 3605 | The output file to write to, |
3645 | .Ar file | 3606 | or standard output if not specified. |
3646 | to write to, or standard output by | ||
3647 | default. | ||
3648 | .It Fl pubin | 3607 | .It Fl pubin |
3649 | The input file is an RSA public key. | 3608 | The 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 |
3654 | Verify the input data and output the recovered data. | 3613 | Verify the input data and output the recovered data. |
3655 | .El | 3614 | .El |
3656 | .Sh RSAUTL NOTES | ||
3657 | .Nm rsautl , | ||
3658 | because it uses the RSA algorithm directly, can only be | ||
3659 | used to sign or verify small pieces of data. | ||
3660 | .Sh RSAUTL EXAMPLES | ||
3661 | Sign some data using a private key: | ||
3662 | .Pp | ||
3663 | .Dl "$ openssl rsautl -sign -in file -inkey key.pem -out sig" | ||
3664 | .Pp | ||
3665 | Recover the signed data: | ||
3666 | .Pp | ||
3667 | .Dl $ openssl rsautl -verify -in sig -inkey key.pem | ||
3668 | .Pp | ||
3669 | Examine 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 | ||
3683 | The PKCS#1 block formatting is evident from this. | ||
3684 | If this was done using encrypt and decrypt, the block would have been of type 2 | ||
3685 | .Pq the second byte | ||
3686 | and random padding data visible instead of the 0xff bytes. | ||
3687 | .Pp | ||
3688 | It is possible to analyse the signature of certificates using this | ||
3689 | utility in conjunction with | ||
3690 | .Nm asn1parse . | ||
3691 | Consider the self-signed example in | ||
3692 | .Pa certs/pca-cert.pem : | ||
3693 | running | ||
3694 | .Nm asn1parse | ||
3695 | as 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 | ||
3719 | The final BIT STRING contains the actual signature. | ||
3720 | It can be extracted with: | ||
3721 | .Pp | ||
3722 | .Dl "$ openssl asn1parse -in pca-cert.pem -out sig -noout -strparse 614" | ||
3723 | .Pp | ||
3724 | The certificate public key can be extracted with: | ||
3725 | .Pp | ||
3726 | .Dl $ openssl x509 -in test/testx509.pem -pubkey -noout \*(Gtpubkey.pem | ||
3727 | .Pp | ||
3728 | The 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 | ||
3740 | This is the parsed version of an ASN1 | ||
3741 | .Em DigestInfo | ||
3742 | structure. | ||
3743 | It can be seen that the digest used was MD5. | ||
3744 | The 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 | ||
3748 | and 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 | ||
3753 | which it can be seen agrees with the recovered value above. | ||
3754 | .\" | 3615 | .\" |
3755 | .\" S_CLIENT | 3616 | .\" S_CLIENT |
3756 | .\" | 3617 | .\" |