Skip to content

Instantly share code, notes, and snippets.

@diorahman
Created October 21, 2015 23:16
Show Gist options
  • Save diorahman/22e763046be04da15b7f to your computer and use it in GitHub Desktop.
Save diorahman/22e763046be04da15b7f to your computer and use it in GitHub Desktop.
$ openssl req -x509 -nodes -newkey rsa:1024 -keyout keyfile.key -out certificate.cer
$ echo "hello!" > data.txt
$ openssl smime -sign -md sha1 \
> -binary -nocerts -noattr \
> -in data.txt -out data.txt.signed -outform der \
> -inkey keyfile.key \
> -signer certificate.cer
$ openssl asn1parse -inform der -in data.txt.signed
$ hexdump -C data.txt
$ xxd -p data.txt.signed
$ xxd -p data.txt.signed > data.txt.signed.hex

@timotgl
Copy link

timotgl commented Nov 7, 2022

Thanks this was very helpful for me. Any idea why this creates the PKCS#7 format even though the -pk7out argument is not used?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment