481 lines
20 KiB
HTML
Executable File
481 lines
20 KiB
HTML
Executable File
<?xml version="1.0" ?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>openssl-pkeyutl</title>
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
<link rev="made" href="mailto:root@localhost" />
|
|
</head>
|
|
|
|
<body style="background-color: white">
|
|
|
|
|
|
<!-- INDEX BEGIN -->
|
|
<div name="index">
|
|
<p><a name="__index__"></a></p>
|
|
|
|
<ul>
|
|
|
|
<li><a href="#name">NAME</a></li>
|
|
<li><a href="#synopsis">SYNOPSIS</a></li>
|
|
<li><a href="#description">DESCRIPTION</a></li>
|
|
<li><a href="#options">OPTIONS</a></li>
|
|
<li><a href="#notes">NOTES</a></li>
|
|
<li><a href="#rsa_algorithm">RSA ALGORITHM</a></li>
|
|
<li><a href="#rsa_pss_algorithm">RSA-PSS ALGORITHM</a></li>
|
|
<li><a href="#dsa_algorithm">DSA ALGORITHM</a></li>
|
|
<li><a href="#dh_algorithm">DH ALGORITHM</a></li>
|
|
<li><a href="#ec_algorithm">EC ALGORITHM</a></li>
|
|
<li><a href="#x25519_and_x448_algorithms">X25519 AND X448 ALGORITHMS</a></li>
|
|
<li><a href="#ed25519_and_ed448_algorithms">ED25519 AND ED448 ALGORITHMS</a></li>
|
|
<li><a href="#sm2">SM2</a></li>
|
|
<li><a href="#examples">EXAMPLES</a></li>
|
|
<li><a href="#see_also">SEE ALSO</a></li>
|
|
<li><a href="#copyright">COPYRIGHT</a></li>
|
|
</ul>
|
|
|
|
<hr name="index" />
|
|
</div>
|
|
<!-- INDEX END -->
|
|
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="name">NAME</a></h1>
|
|
<p>openssl-pkeyutl - public key algorithm utility</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="synopsis">SYNOPSIS</a></h1>
|
|
<p><strong>openssl</strong> <strong>pkeyutl</strong>
|
|
[<strong>-help</strong>]
|
|
[<strong>-in</strong> <em>file</em>]
|
|
[<strong>-rawin</strong>]
|
|
[<strong>-digest</strong> <em>algorithm</em>]
|
|
[<strong>-out</strong> <em>file</em>]
|
|
[<strong>-sigfile</strong> <em>file</em>]
|
|
[<strong>-inkey</strong> <em>file</em>]
|
|
[<strong>-keyform</strong> <strong>DER</strong>|<strong>PEM</strong>|<strong>ENGINE</strong>]
|
|
[<strong>-passin</strong> <em>arg</em>]
|
|
[<strong>-peerkey</strong> <em>file</em>]
|
|
[<strong>-peerform</strong> <strong>DER</strong>|<strong>PEM</strong>|<strong>ENGINE</strong>]
|
|
[<strong>-pubin</strong>]
|
|
[<strong>-certin</strong>]
|
|
[<strong>-rev</strong>]
|
|
[<strong>-sign</strong>]
|
|
[<strong>-verify</strong>]
|
|
[<strong>-verifyrecover</strong>]
|
|
[<strong>-encrypt</strong>]
|
|
[<strong>-decrypt</strong>]
|
|
[<strong>-derive</strong>]
|
|
[<strong>-kdf</strong> <em>algorithm</em>]
|
|
[<strong>-kdflen</strong> <em>length</em>]
|
|
[<strong>-pkeyopt</strong> <em>opt</em>:<em>value</em>]
|
|
[<strong>-pkeyopt_passin</strong> <em>opt</em>[:<em>passarg</em>]]
|
|
[<strong>-hexdump</strong>]
|
|
[<strong>-asn1parse</strong>]
|
|
[<strong>-engine</strong> <em>id</em>]
|
|
[<strong>-engine_impl</strong>]
|
|
[<strong>-rand</strong> <em>files</em>]
|
|
[<strong>-writerand</strong> <em>file</em>]</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="description">DESCRIPTION</a></h1>
|
|
<p>This command can be used to perform low level public key
|
|
operations using any supported algorithm.</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="options">OPTIONS</a></h1>
|
|
<dl>
|
|
<dt><strong><a name="help" class="item"><strong>-help</strong></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Print out a usage message.</p>
|
|
</dd>
|
|
<dt><strong><a name="in_filename" class="item"><strong>-in</strong> <em>filename</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>This specifies the input filename to read data from or standard input
|
|
if this option is not specified.</p>
|
|
</dd>
|
|
<dt><strong><a name="rawin" class="item"><strong>-rawin</strong></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>This indicates that the input data is raw data, which is not hashed by any
|
|
message digest algorithm. The user can specify a digest algorithm by using
|
|
the <strong>-digest</strong> option. This option can only be used with <strong>-sign</strong> and
|
|
<strong>-verify</strong> and must be used with the Ed25519 and Ed448 algorithms.</p>
|
|
</dd>
|
|
<dt><strong><a name="digest_algorithm" class="item"><strong>-digest</strong> <em>algorithm</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>This specifies the digest algorithm which is used to hash the input data before
|
|
signing or verifying it with the input key. This option could be omitted if the
|
|
signature algorithm does not require one (for instance, EdDSA). If this option
|
|
is omitted but the signature algorithm requires one, a default value will be
|
|
used. For signature algorithms like RSA, DSA and ECDSA, SHA-256 will be the
|
|
default digest algorithm. For SM2, it will be SM3. If this option is present,
|
|
then the <strong>-rawin</strong> option must be also specified.</p>
|
|
</dd>
|
|
<dt><strong><a name="out_filename" class="item"><strong>-out</strong> <em>filename</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Specifies the output filename to write to or standard output by
|
|
default.</p>
|
|
</dd>
|
|
<dt><strong><a name="sigfile_file" class="item"><strong>-sigfile</strong> <em>file</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Signature file, required for <strong>-verify</strong> operations only</p>
|
|
</dd>
|
|
<dt><strong><a name="inkey_file" class="item"><strong>-inkey</strong> <em>file</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>The input key file, by default it should be a private key.</p>
|
|
</dd>
|
|
<dt><strong><a name="keyform_der_pem_engine" class="item"><strong>-keyform</strong> <strong>DER</strong>|<strong>PEM</strong>|<strong>ENGINE</strong></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>The key format; the default is <strong>PEM</strong>.
|
|
See <em>openssl(1)/Format Options</em> for details.</p>
|
|
</dd>
|
|
<dt><strong><a name="passin_arg" class="item"><strong>-passin</strong> <em>arg</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>The input key password source. For more information about the format of <em>arg</em>
|
|
see <em>openssl(1)/Pass Phrase Options</em>.</p>
|
|
</dd>
|
|
<dt><strong><a name="peerkey_file" class="item"><strong>-peerkey</strong> <em>file</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>The peer key file, used by key derivation (agreement) operations.</p>
|
|
</dd>
|
|
<dt><strong><a name="peerform_der_pem_engine" class="item"><strong>-peerform</strong> <strong>DER</strong>|<strong>PEM</strong>|<strong>ENGINE</strong></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>The peer key format; the default is <strong>PEM</strong>.
|
|
See <em>openssl(1)/Format Options</em> for details.</p>
|
|
</dd>
|
|
<dt><strong><a name="pubin" class="item"><strong>-pubin</strong></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>The input file is a public key.</p>
|
|
</dd>
|
|
<dt><strong><a name="certin" class="item"><strong>-certin</strong></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>The input is a certificate containing a public key.</p>
|
|
</dd>
|
|
<dt><strong><a name="rev" class="item"><strong>-rev</strong></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Reverse the order of the input buffer. This is useful for some libraries
|
|
(such as CryptoAPI) which represent the buffer in little endian format.</p>
|
|
</dd>
|
|
<dt><strong><a name="sign" class="item"><strong>-sign</strong></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Sign the input data (which must be a hash) and output the signed result. This
|
|
requires a private key.</p>
|
|
</dd>
|
|
<dt><strong><a name="verify" class="item"><strong>-verify</strong></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Verify the input data (which must be a hash) against the signature file and
|
|
indicate if the verification succeeded or failed.</p>
|
|
</dd>
|
|
<dt><strong><a name="verifyrecover" class="item"><strong>-verifyrecover</strong></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Verify the input data (which must be a hash) and output the recovered data.</p>
|
|
</dd>
|
|
<dt><strong><a name="encrypt" class="item"><strong>-encrypt</strong></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Encrypt the input data using a public key.</p>
|
|
</dd>
|
|
<dt><strong><a name="decrypt" class="item"><strong>-decrypt</strong></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Decrypt the input data using a private key.</p>
|
|
</dd>
|
|
<dt><strong><a name="derive" class="item"><strong>-derive</strong></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Derive a shared secret using the peer key.</p>
|
|
</dd>
|
|
<dt><strong><a name="kdf_algorithm" class="item"><strong>-kdf</strong> <em>algorithm</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Use key derivation function <em>algorithm</em>. The supported algorithms are
|
|
at present <strong>TLS1-PRF</strong> and <strong>HKDF</strong>.
|
|
Note: additional parameters and the KDF output length will normally have to be
|
|
set for this to work.
|
|
See <em>EVP_PKEY_CTX_set_hkdf_md(3)</em> and <em>EVP_PKEY_CTX_set_tls1_prf_md(3)</em>
|
|
for the supported string parameters of each algorithm.</p>
|
|
</dd>
|
|
<dt><strong><a name="kdflen_length" class="item"><strong>-kdflen</strong> <em>length</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Set the output length for KDF.</p>
|
|
</dd>
|
|
<dt><strong><a name="pkeyopt_opt_value" class="item"><strong>-pkeyopt</strong> <em>opt</em>:<em>value</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Public key options specified as opt:value. See NOTES below for more details.</p>
|
|
</dd>
|
|
<dt><strong><a name="pkeyopt_passin_opt_passarg" class="item"><strong>-pkeyopt_passin</strong> <em>opt</em>[:<em>passarg</em>]</a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Allows reading a public key option <em>opt</em> from stdin or a password source.
|
|
If only <em>opt</em> is specified, the user will be prompted to enter a password on
|
|
stdin. Alternatively, <em>passarg</em> can be specified which can be any value
|
|
supported by <em>openssl(1)/Pass phrase options</em>.</p>
|
|
</dd>
|
|
<dt><strong><a name="hexdump" class="item"><strong>-hexdump</strong></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>hex dump the output data.</p>
|
|
</dd>
|
|
<dt><strong><a name="asn1parse" class="item"><strong>-asn1parse</strong></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Parse the ASN.1 output data, this is useful when combined with the
|
|
<strong>-verifyrecover</strong> option when an ASN1 structure is signed.</p>
|
|
</dd>
|
|
<dt><strong><a name="engine_id" class="item"><strong>-engine</strong> <em>id</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>See <em>openssl(1)/Engine Options</em>.</p>
|
|
</dd>
|
|
<dt><strong><a name="engine_impl" class="item"><strong>-engine_impl</strong></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>When used with the <strong>-engine</strong> option, it specifies to also use
|
|
engine <em>id</em> for crypto operations.</p>
|
|
</dd>
|
|
<dt><strong><a name="rand_files_writerand_file" class="item"><strong>-rand</strong> <em>files</em>, <strong>-writerand</strong> <em>file</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>See <em>openssl(1)/Random State Options</em> for details.</p>
|
|
</dd>
|
|
</dl>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="notes">NOTES</a></h1>
|
|
<p>The operations and options supported vary according to the key algorithm
|
|
and its implementation. The OpenSSL operations and options are indicated below.</p>
|
|
<p>Unless otherwise mentioned all algorithms support the <strong>digest:</strong><em>alg</em> option
|
|
which specifies the digest in use for sign, verify and verifyrecover operations.
|
|
The value <em>alg</em> should represent a digest name as used in the
|
|
<code>EVP_get_digestbyname()</code> function for example <strong>sha1</strong>. This value is not used to
|
|
hash the input data. It is used (by some algorithms) for sanity-checking the
|
|
lengths of data passed in and for creating the structures that make up the
|
|
signature (e.g. <strong>DigestInfo</strong> in RSASSA PKCS#1 v1.5 signatures).</p>
|
|
<p>This command does not hash the input data (except where -rawin is used) but
|
|
rather it will use the data directly as input to the signature algorithm.
|
|
Depending on the key type, signature type, and mode of padding, the maximum
|
|
acceptable lengths of input data differ. The signed data can't be longer than
|
|
the key modulus with RSA. In case of ECDSA and DSA the data shouldn't be longer
|
|
than the field size, otherwise it will be silently truncated to the field size.
|
|
In any event the input size must not be larger than the largest supported digest
|
|
size.</p>
|
|
<p>In other words, if the value of digest is <strong>sha1</strong> the input should be the 20
|
|
bytes long binary encoding of the SHA-1 hash function output.</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="rsa_algorithm">RSA ALGORITHM</a></h1>
|
|
<p>The RSA algorithm generally supports the encrypt, decrypt, sign,
|
|
verify and verifyrecover operations. However, some padding modes
|
|
support only a subset of these operations. The following additional
|
|
<strong>pkeyopt</strong> values are supported:</p>
|
|
<dl>
|
|
<dt><strong><a name="rsa_padding_mode_mode" class="item"><strong>rsa_padding_mode:</strong><em>mode</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>This sets the RSA padding mode. Acceptable values for <em>mode</em> are <strong>pkcs1</strong> for
|
|
PKCS#1 padding, <strong>sslv23</strong> for SSLv23 padding, <strong>none</strong> for no padding, <strong>oaep</strong>
|
|
for <strong>OAEP</strong> mode, <strong>x931</strong> for X9.31 mode and <strong>pss</strong> for PSS.</p>
|
|
<p>In PKCS#1 padding if the message digest is not set then the supplied data is
|
|
signed or verified directly instead of using a <strong>DigestInfo</strong> structure. If a
|
|
digest is set then the a <strong>DigestInfo</strong> structure is used and its the length
|
|
must correspond to the digest type.</p>
|
|
<p>For <strong>oaep</strong> mode only encryption and decryption is supported.</p>
|
|
<p>For <strong>x931</strong> if the digest type is set it is used to format the block data
|
|
otherwise the first byte is used to specify the X9.31 digest ID. Sign,
|
|
verify and verifyrecover are can be performed in this mode.</p>
|
|
<p>For <strong>pss</strong> mode only sign and verify are supported and the digest type must be
|
|
specified.</p>
|
|
</dd>
|
|
<dt><strong><a name="rsa_pss_saltlen_len" class="item"><strong>rsa_pss_saltlen:</strong><em>len</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>For <strong>pss</strong> mode only this option specifies the salt length. Three special
|
|
values are supported: <strong>digest</strong> sets the salt length to the digest length,
|
|
<strong>max</strong> sets the salt length to the maximum permissible value. When verifying
|
|
<strong>auto</strong> causes the salt length to be automatically determined based on the
|
|
<strong>PSS</strong> block structure.</p>
|
|
</dd>
|
|
<dt><strong><a name="rsa_mgf1_md_digest" class="item"><strong>rsa_mgf1_md:</strong><em>digest</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>For PSS and OAEP padding sets the MGF1 digest. If the MGF1 digest is not
|
|
explicitly set in PSS mode then the signing digest is used.</p>
|
|
</dd>
|
|
</dl>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="rsa_pss_algorithm">RSA-PSS ALGORITHM</a></h1>
|
|
<p>The RSA-PSS algorithm is a restricted version of the RSA algorithm which only
|
|
supports the sign and verify operations with PSS padding. The following
|
|
additional <strong>-pkeyopt</strong> values are supported:</p>
|
|
<dl>
|
|
<dt><strong><a name="rsa_padding_mode_mode_rsa_pss_saltlen_len_rsa_mgf1_md_digest" class="item"><strong>rsa_padding_mode:</strong><em>mode</em>, <strong>rsa_pss_saltlen:</strong><em>len</em>,
|
|
<strong>rsa_mgf1_md:</strong><em>digest</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>These have the same meaning as the <strong>RSA</strong> algorithm with some additional
|
|
restrictions. The padding mode can only be set to <strong>pss</strong> which is the
|
|
default value.</p>
|
|
<p>If the key has parameter restrictions than the digest, MGF1
|
|
digest and salt length are set to the values specified in the parameters.
|
|
The digest and MG cannot be changed and the salt length cannot be set to a
|
|
value less than the minimum restriction.</p>
|
|
</dd>
|
|
</dl>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="dsa_algorithm">DSA ALGORITHM</a></h1>
|
|
<p>The DSA algorithm supports signing and verification operations only. Currently
|
|
there are no additional <strong>-pkeyopt</strong> options other than <strong>digest</strong>. The SHA1
|
|
digest is assumed by default.</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="dh_algorithm">DH ALGORITHM</a></h1>
|
|
<p>The DH algorithm only supports the derivation operation and no additional
|
|
<strong>-pkeyopt</strong> options.</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="ec_algorithm">EC ALGORITHM</a></h1>
|
|
<p>The EC algorithm supports sign, verify and derive operations. The sign and
|
|
verify operations use ECDSA and derive uses ECDH. SHA1 is assumed by default for
|
|
the <strong>-pkeyopt</strong> <strong>digest</strong> option.</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="x25519_and_x448_algorithms">X25519 AND X448 ALGORITHMS</a></h1>
|
|
<p>The X25519 and X448 algorithms support key derivation only. Currently there are
|
|
no additional options.</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="ed25519_and_ed448_algorithms">ED25519 AND ED448 ALGORITHMS</a></h1>
|
|
<p>These algorithms only support signing and verifying. OpenSSL only implements the
|
|
"pure" variants of these algorithms so raw data can be passed directly to them
|
|
without hashing them first. The option <strong>-rawin</strong> must be used with these
|
|
algorithms with no <strong>-digest</strong> specified. Additionally OpenSSL only supports
|
|
"oneshot" operation with these algorithms. This means that the entire file to
|
|
be signed/verified must be read into memory before processing it. Signing or
|
|
Verifying very large files should be avoided. Additionally the size of the file
|
|
must be known for this to work. If the size of the file cannot be determined
|
|
(for example if the input is stdin) then the sign or verify operation will fail.</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="sm2">SM2</a></h1>
|
|
<p>The SM2 algorithm supports sign, verify, encrypt and decrypt operations. For
|
|
the sign and verify operations, SM2 requires an ID string to be passed in. The
|
|
following <strong>-pkeyopt</strong> value is supported:</p>
|
|
<dl>
|
|
<dt><strong><a name="sm2_id_string" class="item"><strong>sm2_id:</strong><em>string</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>This sets the ID string used in SM2 sign or verify operations. While verifying
|
|
an SM2 signature, the ID string must be the same one used when signing the data.
|
|
Otherwise the verification will fail.</p>
|
|
</dd>
|
|
<dt><strong><a name="sm2_hex_id_hex_string" class="item"><strong>sm2_hex_id:</strong><em>hex_string</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>This sets the ID string used in SM2 sign or verify operations. While verifying
|
|
an SM2 signature, the ID string must be the same one used when signing the data.
|
|
Otherwise the verification will fail. The ID string provided with this option
|
|
should be a valid hexadecimal value.</p>
|
|
</dd>
|
|
</dl>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="examples">EXAMPLES</a></h1>
|
|
<p>Sign some data using a private key:</p>
|
|
<pre>
|
|
openssl pkeyutl -sign -in file -inkey key.pem -out sig</pre>
|
|
<p>Recover the signed data (e.g. if an RSA key is used):</p>
|
|
<pre>
|
|
openssl pkeyutl -verifyrecover -in sig -inkey key.pem</pre>
|
|
<p>Verify the signature (e.g. a DSA key):</p>
|
|
<pre>
|
|
openssl pkeyutl -verify -in file -sigfile sig -inkey key.pem</pre>
|
|
<p>Sign data using a message digest value (this is currently only valid for RSA):</p>
|
|
<pre>
|
|
openssl pkeyutl -sign -in file -inkey key.pem -out sig -pkeyopt digest:sha256</pre>
|
|
<p>Derive a shared secret value:</p>
|
|
<pre>
|
|
openssl pkeyutl -derive -inkey key.pem -peerkey pubkey.pem -out secret</pre>
|
|
<p>Hexdump 48 bytes of TLS1 PRF using digest <strong>SHA256</strong> and shared secret and
|
|
seed consisting of the single byte 0xFF:</p>
|
|
<pre>
|
|
openssl pkeyutl -kdf TLS1-PRF -kdflen 48 -pkeyopt md:SHA256 \
|
|
-pkeyopt hexsecret:ff -pkeyopt hexseed:ff -hexdump</pre>
|
|
<p>Derive a key using <strong>scrypt</strong> where the password is read from command line:</p>
|
|
<pre>
|
|
openssl pkeyutl -kdf scrypt -kdflen 16 -pkeyopt_passin pass \
|
|
-pkeyopt hexsalt:aabbcc -pkeyopt N:16384 -pkeyopt r:8 -pkeyopt p:1</pre>
|
|
<p>Derive using the same algorithm, but read key from environment variable MYPASS:</p>
|
|
<pre>
|
|
openssl pkeyutl -kdf scrypt -kdflen 16 -pkeyopt_passin pass:env:MYPASS \
|
|
-pkeyopt hexsalt:aabbcc -pkeyopt N:16384 -pkeyopt r:8 -pkeyopt p:1</pre>
|
|
<p>Sign some data using an <em>SM2(7)</em> private key and a specific ID:</p>
|
|
<pre>
|
|
openssl pkeyutl -sign -in file -inkey sm2.key -out sig -rawin -digest sm3 \
|
|
-pkeyopt sm2_id:someid</pre>
|
|
<p>Verify some data using an <em>SM2(7)</em> certificate and a specific ID:</p>
|
|
<pre>
|
|
openssl pkeyutl -verify -certin -in file -inkey sm2.cert -sigfile sig \
|
|
-rawin -digest sm3 -pkeyopt sm2_id:someid</pre>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="see_also">SEE ALSO</a></h1>
|
|
<p><em>openssl(1)</em>,
|
|
<em>openssl-genpkey(1)</em>,
|
|
<em>openssl-pkey(1)</em>,
|
|
<em>openssl-rsautl(1)</em>
|
|
<em>openssl-dgst(1)</em>,
|
|
<em>openssl-rsa(1)</em>,
|
|
<em>openssl-genrsa(1)</em>,
|
|
<em>openssl-kdf(1)</em>
|
|
<em>EVP_PKEY_CTX_set_hkdf_md(3)</em>,
|
|
<em>EVP_PKEY_CTX_set_tls1_prf_md(3)</em>,</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="copyright">COPYRIGHT</a></h1>
|
|
<p>Copyright 2006-2019 The OpenSSL Project Authors. All Rights Reserved.</p>
|
|
<p>Licensed under the Apache License 2.0 (the "License"). You may not use
|
|
this file except in compliance with the License. You can obtain a copy
|
|
in the file LICENSE in the source distribution or at
|
|
<a href="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</a>.</p>
|
|
|
|
</body>
|
|
|
|
</html>
|