Documentation ¶
Index ¶
- type KeyManager
- type SphincsManager
- func (sm *SphincsManager) DeserializePK(params *parameters.Parameters, pkBytes []byte) (*sphincs.SPHINCS_PK, error)
- func (sm *SphincsManager) DeserializeSK(params *parameters.Parameters, skBytes []byte) (*sphincs.SPHINCS_SK, error)
- func (sm *SphincsManager) DeserializeSignature(params *parameters.Parameters, sigBytes []byte) (*sphincs.SPHINCS_SIG, error)
- func (sm *SphincsManager) GenerateKeys(params *parameters.Parameters) (*sphincs.SPHINCS_SK, *sphincs.SPHINCS_PK)
- func (sm *SphincsManager) SerializePK(pk *sphincs.SPHINCS_PK) ([]byte, error)
- func (sm *SphincsManager) SerializeSK(sk *sphincs.SPHINCS_SK) ([]byte, error)
- func (sm *SphincsManager) SerializeSignature(sig *sphincs.SPHINCS_SIG) ([]byte, error)
- func (sm *SphincsManager) SignMessage(params *parameters.Parameters, message []byte, sk *sphincs.SPHINCS_SK) (*sphincs.SPHINCS_SIG, *sphinx.HashTreeNode, error)
- func (sm *SphincsManager) VerifySignature(params *parameters.Parameters, message []byte, sig *sphincs.SPHINCS_SIG, ...) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyManager ¶
type KeyManager interface { // GenerateKeys generates a new pair of secret and public keys based on the provided parameters GenerateKeys(params *parameters.Parameters) (*sphincs.SPHINCS_SK, *sphincs.SPHINCS_PK) // SignMessage signs a given message using the secret key, returns the signature and the Merkle tree root node SignMessage(params *parameters.Parameters, message []byte, sk *sphincs.SPHINCS_SK) (*sphincs.SPHINCS_SIG, *sphinx.HashTreeNode, error) // VerifySignature checks if a signature is valid for a given message and public key, using the Merkle tree root node VerifySignature(params *parameters.Parameters, message []byte, sig *sphincs.SPHINCS_SIG, pk *sphincs.SPHINCS_PK, merkleRoot *sphinx.HashTreeNode) bool // SerializeSK converts a secret key to a byte slice SerializeSK(sk *sphincs.SPHINCS_SK) ([]byte, error) // DeserializeSK converts a byte slice back into a secret key DeserializeSK(params *parameters.Parameters, skBytes []byte) (*sphincs.SPHINCS_SK, error) // SerializePK converts a public key to a byte slice SerializePK(pk *sphincs.SPHINCS_PK) ([]byte, error) // DeserializePK converts a byte slice back into a public key DeserializePK(params *parameters.Parameters, pkBytes []byte) (*sphincs.SPHINCS_PK, error) // SerializeSignature converts a signature to a byte slice SerializeSignature(sig *sphincs.SPHINCS_SIG) ([]byte, error) // DeserializeSignature converts a byte slice back into a signature DeserializeSignature(params *parameters.Parameters, sigBytes []byte) (*sphincs.SPHINCS_SIG, error) }
KeyManager interface defines methods for key management and cryptographic operations
type SphincsManager ¶
type SphincsManager struct {
// contains filtered or unexported fields
}
SphincsManager implements the KeyManager interface for SPHINCS+ operations
func NewSphincsManager ¶
func NewSphincsManager(db *leveldb.DB) *SphincsManager
NewSphincsManager creates a new instance of SphincsManager with a LevelDB instance
func (*SphincsManager) DeserializePK ¶
func (sm *SphincsManager) DeserializePK(params *parameters.Parameters, pkBytes []byte) (*sphincs.SPHINCS_PK, error)
DeserializePK deserializes a byte slice into a public key (pk) using the provided parameters
func (*SphincsManager) DeserializeSK ¶
func (sm *SphincsManager) DeserializeSK(params *parameters.Parameters, skBytes []byte) (*sphincs.SPHINCS_SK, error)
DeserializeSK deserializes a byte slice into a secret key (sk) using the provided parameters
func (*SphincsManager) DeserializeSignature ¶
func (sm *SphincsManager) DeserializeSignature(params *parameters.Parameters, sigBytes []byte) (*sphincs.SPHINCS_SIG, error)
DeserializeSignature deserializes a byte slice into a signature (sig) using the provided parameters
func (*SphincsManager) GenerateKeys ¶
func (sm *SphincsManager) GenerateKeys(params *parameters.Parameters) (*sphincs.SPHINCS_SK, *sphincs.SPHINCS_PK)
GenerateKeys generates a new pair of secret and public keys
func (*SphincsManager) SerializePK ¶
func (sm *SphincsManager) SerializePK(pk *sphincs.SPHINCS_PK) ([]byte, error)
SerializePK serializes the public key (pk) into a byte slice
func (*SphincsManager) SerializeSK ¶
func (sm *SphincsManager) SerializeSK(sk *sphincs.SPHINCS_SK) ([]byte, error)
Helper functions for key serialization and deserialization SerializeSK serializes the secret key (sk) into a byte slice
func (*SphincsManager) SerializeSignature ¶
func (sm *SphincsManager) SerializeSignature(sig *sphincs.SPHINCS_SIG) ([]byte, error)
SerializeSignature serializes a signature (sig) into a byte slice
func (*SphincsManager) SignMessage ¶
func (sm *SphincsManager) SignMessage(params *parameters.Parameters, message []byte, sk *sphincs.SPHINCS_SK) (*sphincs.SPHINCS_SIG, *sphinx.HashTreeNode, error)
SignMessage signs a given message using the secret key
func (*SphincsManager) VerifySignature ¶
func (sm *SphincsManager) VerifySignature(params *parameters.Parameters, message []byte, sig *sphincs.SPHINCS_SIG, pk *sphincs.SPHINCS_PK, merkleRoot *sphinx.HashTreeNode) bool
VerifySignature verifies if a signature is valid for a given message and public key