package dsa
Import Path
crypto/dsa (on golang.org and go.dev)
Dependency Relation
imports 4 packages, and imported by one package
Involved Source Files
d-> dsa.go
Exported Type Names
Exported Values
var
ErrInvalidPublicKey error
ErrInvalidPublicKey results when a public key is not usable by this code.
FIPS is quite strict about the format of DSA keys, but other code may be
less so. Thus, when using keys which may have been generated by other code,
this error must be handled.
func
GenerateKey(priv *
PrivateKey, rand
io.
Reader)
error
GenerateKey generates a public&private key pair. The Parameters of the
PrivateKey must already be valid (see GenerateParameters).
func
Sign(rand
io.
Reader, priv *
PrivateKey, hash []
byte) (r, s *
big.
Int, err
error)
Sign signs an arbitrary length hash (which should be the result of hashing a
larger message) using the private key, priv. It returns the signature as a
pair of integers. The security of the private key depends on the entropy of
rand.
Note that FIPS 186-3 section 4.6 specifies that the hash should be truncated
to the byte-length of the subgroup. This function does not perform that
truncation itself.
Be aware that calling Sign with an attacker-controlled PrivateKey may
require an arbitrary amount of CPU.
func
Verify(pub *
PublicKey, hash []
byte, r, s *
big.
Int)
bool
Verify verifies the signature in r, s of hash using the public key, pub. It
reports whether the signature is valid.
Note that FIPS 186-3 section 4.6 specifies that the hash should be truncated
to the byte-length of the subgroup. This function does not perform that
truncation itself.
 |
The pages are generated with Golds v0.1.6. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project and developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |