Fix SM2 sign/verify example

pkey sm2 sign/verify need a 32-byte digest as input
This commit is contained in:
Zhi Guan
2017-12-13 18:30:32 +08:00
committed by GitHub
parent f5ac80af1d
commit 2443ff48eb

View File

@@ -136,8 +136,8 @@ $ gmssl pkey -pubout -in skey.pem -out vkey.pem
SM2 signature generation and verification:
```sh
$ gmssl pkeyutl -sign -pkeyopt ec_scheme:sm2 -inkey skey.pem -in README.md -out README.md.sig
$ gmssl pkeyutl -verify -pkeyopt ec_scheme:sm2 -pubin -inkey vkey.pem -in README.md -sigfile README.md.sig
$ gmssl sm3 -binary README.md | gmssl pkeyutl -sign -pkeyopt ec_scheme:sm2 -inkey skey.pem -out README.md.sig
$ gmssl sm3 -binary README.md | gmssl pkeyutl -verify -pkeyopt ec_scheme:sm2 -pubin -inkey vkey.pem -sigfile README.md.sig
```
Generate SM2 encryption key pair and do SM2 public key encyption/decryption. It should be noted `pkeyutl -encrypt` should only be used to encrypt short messages such as session key and passphrase.