Namespace: go.std.crypto.dsa
v1.0Contents
Summary
Provides a low-level interface to the crypto/dsa package.
Package dsa implements the Digital Signature Algorithm, as defined in FIPS 186-3.
The DSA operations in this package are not implemented using constant-time algorithms.
Deprecated: DSA is a legacy algorithm, and modern alternatives such as
Ed25519 (implemented by package crypto/ed25519) should be used instead. Keys
with 1024-bit moduli (L1024N160 parameters) are cryptographically weak, while
bigger keys are not widely supported. Note that FIPS 186-5 no longer approves
DSA for signature generation.
Index
- *ParameterSizes
- *Parameters
- *PrivateKey
- *PublicKey
- ErrInvalidPublicKey
- GenerateKey
- GenerateParameters
- L1024N160
- L2048N224
- L2048N256
- L3072N256
- ParameterSizes
- Parameters
- PrivateKey
- PublicKey
- Sign
- Verify
- arrayOfParameterSizes
- arrayOfParameters
- arrayOfPrivateKey
- arrayOfPublicKey
Legend
-
Constant
Variable
Function
Macro
Special form
Type
GoVar
Receiver/Method
Constants
Constants are variables with :const true in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.-
(None.)
Variables
-
ErrInvalidPublicKey
Var v1.0ErrInvalidPublicKey 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.
-
L1024N160
GoObject v1.0 -
L2048N224
GoObject v1.0 -
L2048N256
GoObject v1.0 -
L3072N256
GoObject v1.0
Functions, Macros, and Special Forms
-
GenerateKey
Function v1.0(GenerateKey priv rand)
GenerateKey generates a public&private key pair. The Parameters of the
PrivateKey must already be valid (see GenerateParameters).
Go input arguments: (priv *PrivateKey, rand io.Reader)
Go returns: error
Joker input arguments: [^*PrivateKey priv, ^go.std.io/Reader rand]
Joker returns: ^Error -
GenerateParameters
Function v1.0(GenerateParameters params rand sizes)
GenerateParameters puts a random, valid set of DSA parameters into params.
This function can take many seconds, even on fast machines.
Go input arguments: (params *Parameters, rand io.Reader, sizes ParameterSizes)
Go returns: error
Joker input arguments: [^*Parameters params, ^go.std.io/Reader rand, ^ParameterSizes sizes]
Joker returns: ^Error -
Sign
Function v1.0(Sign rand priv hash)
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.
Go input arguments: (rand io.Reader, priv *PrivateKey, hash []byte)
Go returns: (r *math/big.Int, s *math/big.Int, err error)
Joker input arguments: [^go.std.io/Reader rand, ^*PrivateKey priv, ^arrayOfByte hash]
Joker returns: [^go.std.math.big/*Int r, ^go.std.math.big/*Int s, ^Error err] -
Verify
Function v1.0(Verify pub hash r s)
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.
Go input arguments: (pub *PublicKey, hash []byte, r *math/big.Int, s *math/big.Int)
Go returns: bool
Joker input arguments: [^*PublicKey pub, ^arrayOfByte hash, ^go.std.math.big/*Int r, ^go.std.math.big/*Int s]
Joker returns: ^Boolean
Types
-
*ParameterSizes
Concrete Type v1.0ParameterSizes is an enumeration of the acceptable bit lengths of the primes
in a set of DSA parameters. See FIPS 186-3, section 4.2.
-
*Parameters
Concrete Type v1.0Parameters represents the domain parameters for a key. These parameters can
be shared across many keys. The bit length of Q must be a multiple of 8.
-
*PrivateKey
Concrete Type v1.0PrivateKey represents a DSA private key.
-
*PublicKey
Concrete Type v1.0PublicKey represents a DSA public key.
-
ParameterSizes
Concrete Type v1.0ParameterSizes is an enumeration of the acceptable bit lengths of the primes
in a set of DSA parameters. See FIPS 186-3, section 4.2.
-
Parameters
Concrete Type v1.0Parameters represents the domain parameters for a key. These parameters can
be shared across many keys. The bit length of Q must be a multiple of 8.
-
PrivateKey
Concrete Type v1.0PrivateKey represents a DSA private key.
-
PublicKey
Concrete Type v1.0PublicKey represents a DSA public key.
-
arrayOfParameterSizes
Concrete Type v1.0ParameterSizes is an enumeration of the acceptable bit lengths of the primes
in a set of DSA parameters. See FIPS 186-3, section 4.2.
-
arrayOfParameters
Concrete Type v1.0Parameters represents the domain parameters for a key. These parameters can
be shared across many keys. The bit length of Q must be a multiple of 8.
-
arrayOfPrivateKey
Concrete Type v1.0PrivateKey represents a DSA private key.
-
arrayOfPublicKey
Concrete Type v1.0PublicKey represents a DSA public key.