Documentation
¶
Index ¶
Constants ¶
const ( AddressTypeWOTSHash addressType = iota AddressTypeWOTSPK AddressTypeTree AddressTypeFORSTree AddressTypeFORSRoots AddressTypeWOTSPRF AddressTypeFORSPRF )
Variables ¶
var ( SLHDSA128SmallSHA2 = params{ // contains filtered or unexported fields } SLHDSA128SmallSM3 = params{ // contains filtered or unexported fields } SLHDSA128SmallSHAKE = params{ // contains filtered or unexported fields } SLHDSA128FastSHA2 = params{ // contains filtered or unexported fields } SLHDSA128FastSM3 = params{ // contains filtered or unexported fields } SLHDSA128FastSHAKE = params{ // contains filtered or unexported fields } SLHDSA192SmallSHA2 = params{ // contains filtered or unexported fields } SLHDSA192SmallSHAKE = params{ // contains filtered or unexported fields } SLHDSA192FastSHA2 = params{ // contains filtered or unexported fields } SLHDSA192FastSHAKE = params{ // contains filtered or unexported fields } SLHDSA256SmallSHA2 = params{ // contains filtered or unexported fields } SLHDSA256SmallSHAKE = params{ // contains filtered or unexported fields } SLHDSA256FastSHA2 = params{ // contains filtered or unexported fields } SLHDSA256FastSHAKE = params{ // contains filtered or unexported fields } )
sigLen = (1+k*(1+a)+d*(hm+len))*n
Functions ¶
func GetParameterSet ¶
Types ¶
type PrivateKey ¶
type PrivateKey struct {
PublicKey
// contains filtered or unexported fields
}
func GenerateKey ¶
func GenerateKey(rand io.Reader, params *params) (*PrivateKey, error)
GenerateKey generates a new private key based on the provided parameters. It initializes the key structure, fills the necessary fields with provided entropy, and computes the root node for the XMSS tree.
func NewPrivateKey ¶
func NewPrivateKey(bytes []byte, params *params) (*PrivateKey, error)
NewPrivateKey creates a new PrivateKey instance from the provided priv.seed||priv.prf||pub.seed||pub.root and parameters. The function validates the length of the input byte slice and initializes the PrivateKey structure, including its PublicKey field. It also verifies the integrity of the key by comparing the root hash with the expected value. If any validation or initialization step fails, an error is returned.
func (*PrivateKey) Bytes ¶
func (sk *PrivateKey) Bytes() []byte
Bytes serializes the PrivateKey into a byte slice.
func (*PrivateKey) Equal ¶
func (sk *PrivateKey) Equal(x any) bool
func (*PrivateKey) Public ¶
func (sk *PrivateKey) Public() *PublicKey
Public returns the public key of the private key.
func (*PrivateKey) Sign ¶
func (sk *PrivateKey) Sign(message, context, addRand []byte) ([]byte, error)
Sign generates a pure SLH-DSA signature for the given message. The signature is deterministic if the addRand parameter is nil. If addRand is not nil, it must be of the same length as n.
See FIPS 205 Algorithm 22 slh_sign
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
func NewPublicKey ¶
NewPublicKey creates a new PublicKey instance from the provided seed||root and parameters. Note this method can NOT verify the validity of the public key.