Openssl dgst Command

Source: Internet
Author: User

First, Introduction

Message digest can generate a fixed length (16 or 20 bytes) of information summary for any length of message, based on a one-way hash function, the message digest cannot be recovered from the original text, so it is safe; the source text and message digest is one by one corresponding, so it is called a fingerprint.

Second, the grammar

OpenSSL Dgst[-md5|-md4|-md2|-sha1|-sha|-mdc2|-ripemd160|-dss1] [-c] [-d] [-hex] [-binary] [-out filename] [-sign FileName] [-keyform arg] [-passin arg] [-verify filename] [-prverify filename] [-signature filename] [-hmac key] [file ...]

Options

-c to output the digest with separating colons-R to output the digestinchcoreutils Format-D to Output debugInfo-hex Output as hex dump-binary outputinchbinary Form-signfileSign Digest using private keyinch file-verifyfileVerify a signature using public keyinch file-prverifyfileVerify a signature using private keyinch file-keyform Arg keyfileformat (PEM or ENGINE)-Out filename output to filename rather than stdout-signaturefilesignature to verify-sigopt nm:v Signature parameter-HMAC key Create hashed MAC with key-mac algorithm Create MAC (not neccessarily HMAC)-macopt nm:v MAC algorithm parameters or key-engine e Use engine E, possibly a hardware device.-MD4 to use the MD4 message digest algorithm-MD5 to use the MD5 message digest algorithm-ripemd160 to use the ripemd160 message digest algorithm-Sha to use the SHA message digest algorithm-SHA1 to use the SHA1 message digest algorithm-sha224 to use the sha224 message digest algorithm-SHA256 to use the sha256 message digest algorithm-sha384 to use the sha384 message digest algorithm-sha512 to use the sha512 message digest algorithm-whirlpool to use the Whirlpool message digest algorithm

Third, examples

1. Message Digest of the file

OpenSSL dgst-md5 Test.txt

2. Sign the message digest with the private key and check it with the public key

OpenSSL dgst-md5-sign Prikey.pem-outsign.binary test.txt     -md5-verify pubkey.pem-signature sign.binary t Est.txt

3. Message Authentication Code

" 123456 " test.txt

Reference: http://blog.csdn.net/fym0121/article/details/7982620

Openssl dgst Command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.