// Generated by Lisette bindgen
// Source: crypto/dsa (Go stdlib)
// Go: 1.25.5
// Lisette: 0.1.20

import "go:io"
import "go:math/big"

pub enum ParameterSizes: int {
  L1024N160 = 0,
  L2048N224 = 1,
  L2048N256 = 2,
  L3072N256 = 3,
}

pub const L1024N160: ParameterSizes = 0

pub const L2048N224: ParameterSizes = 1

pub const L2048N256: ParameterSizes = 2

pub const L3072N256: ParameterSizes = 3

/// GenerateKey generates a public&private key pair. The Parameters of the
/// [PrivateKey] must already be valid (see [GenerateParameters]).
pub fn GenerateKey(priv: Ref<PrivateKey>, rand: io.Reader) -> Result<(), error>

/// GenerateParameters puts a random, valid set of DSA parameters into params.
/// This function can take many seconds, even on fast machines.
pub fn GenerateParameters(
  params: Ref<Parameters>,
  rand: io.Reader,
  sizes: ParameterSizes,
) -> Result<(), 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.
pub fn Sign(rand: io.Reader, priv: Ref<PrivateKey>, hash: Slice<uint8>) -> Result<(Ref<big.Int>, Ref<big.Int>), error>

/// 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.
pub fn Verify(
  pub_: Ref<PublicKey>,
  hash: Slice<uint8>,
  r: Ref<big.Int>,
  s: Ref<big.Int>,
) -> bool

/// Parameters 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.
pub struct Parameters {
  pub P: Option<Ref<big.Int>>,
  pub Q: Option<Ref<big.Int>>,
  pub G: Option<Ref<big.Int>>,
}

/// PrivateKey represents a DSA private key.
pub struct PrivateKey {
  pub PublicKey: PublicKey,
  pub X: Option<Ref<big.Int>>,
}

/// PublicKey represents a DSA public key.
pub struct PublicKey {
  pub Parameters: Parameters,
  pub Y: Option<Ref<big.Int>>,
}

/// 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.
pub var ErrInvalidPublicKey: error
