Codex

RSAUTL

Section: OpenSSL (1SSL)

Updated: 2014-07-22

Index?action=index Return to Main Contents


NAME

rsautl - RSA utility

SYNOPSIS

openssl rsautl [-in file] [-out file] [-inkey file] [-pubin] [-certin] [-sign] [-verify] [-encrypt] [-decrypt] [-pkcs] [-ssl] [-raw] [-hexdump] [-asn1parse]

DESCRIPTION

The rsautl command can be used to sign, verify, encrypt and decrypt data using the RSA algorithm.

COMMAND OPTIONS

-in filename
This specifies the input filename to read data from or standard input if this option is not specified.:
-out filename
specifies the output filename to write to or standard output by default.:
-inkey file:the input key file, by default it should be an RSA private key.
-pubin
the input file is an RSA public key.:
-certin
the input is a certificate containing an RSA public key.:
-sign
sign the input data and output the signed result. This requires and RSA private key.:
-verify
verify the input data and output the recovered data.:
-encrypt
encrypt the input data using an RSA public key.:
-decrypt
decrypt the input data using an RSA private key.:
-pkcs, -oaep, -ssl, -raw
the padding to use: PKCS#1 v1.5 (the default), PKCS#1 OAEP, special padding used in SSL v2 backwards compatible handshakes, or no padding, respectively. For signatures, only -pkcs and -raw can be used.:
-hexdump
hex dump the output data.:
-asn1parse
asn1parse the output data, this is useful when combined with the -verify option.:

NOTES

rsautl because it uses the RSA algorithm directly can only be used to sign or verify small pieces of data.

EXAMPLES

Sign some data using a private key:

Recover the signed data

Examine the raw signed data:

The PKCS#1 block formatting is evident from this. If this was done using encrypt and decrypt the block would have been of type 2 (the second byte) and random padding data visible instead of the 0xff bytes.

It is possible to analyse the signature of certificates using this utility in conjunction with asn1parse. Consider the self signed example in certs/pca-cert.pem . Running asn1parse as follows yields:

The final BIT STRING contains the actual signature. It can be extracted with:

The certificate public key can be extracted with:

The signature can be analysed with:

This is the parsed version of an ASN1 DigestInfo structure. It can be seen that the digest used was md5. The actual part of the certificate that was signed can be extracted with:

and its digest computed with:

which it can be seen agrees with the recovered value above.

SEE ALSO

dgst?(1), rsa?(1), genrsa?(1)


Index

NAME

SYNOPSIS

DESCRIPTION

COMMAND OPTIONS

NOTES

EXAMPLES

SEE ALSO


More Man Pages