Documentation ¶
Overview ¶
Package pkcs11test implements utilities for testing the chaps pkcs#11 keystore.
Index ¶
- func ChangeP11TestTokenAuthData(ctx context.Context, r hwsec.CmdRunner, ...) error
- func CleanupP11TestToken(ctx context.Context, r hwsec.CmdRunner, scratchpadPath string) error
- func CleanupScratchpad(ctx context.Context, r hwsec.CmdRunner, scratchpadPath string) error
- func LoadP11TestToken(ctx context.Context, r hwsec.CmdRunner, scratchpadPath, authData string) (string, error)
- func PrepareScratchpadAndTestFiles(ctx context.Context, r hwsec.CmdRunner, scratchpadPath string) (testfile1, testfile2 string, retErr error)
- func SetupP11TestToken(ctx context.Context, r hwsec.CmdRunner, scratchpadPath string) error
- func SignAndVerify(ctx context.Context, p *pkcs11.Chaps, key *pkcs11.KeyInfo, ...) error
- func UnloadP11TestToken(ctx context.Context, r hwsec.CmdRunner, scratchpadPath string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChangeP11TestTokenAuthData ¶
func ChangeP11TestTokenAuthData(ctx context.Context, r hwsec.CmdRunner, scratchpadPath, authData, newAuthData string) error
ChangeP11TestTokenAuthData changes authorization data auth_data by new_auth_data stored in scratchpadPath.
func CleanupP11TestToken ¶
CleanupP11TestToken deletes the test token stored in scratchpadPath.
func CleanupScratchpad ¶
CleanupScratchpad removes the scratchpad at ScratchpadPath. This is usually called at the end of the test.
func LoadP11TestToken ¶
func LoadP11TestToken(ctx context.Context, r hwsec.CmdRunner, scratchpadPath, authData string) (string, error)
LoadP11TestToken loads the test token onto a slot stored in scratchpadPath and return the slot number. LoadP11TestToken returns an invalid slot number that is larger than the max slot chapsd supports with non-nil error when it fails.
func PrepareScratchpadAndTestFiles ¶
func PrepareScratchpadAndTestFiles(ctx context.Context, r hwsec.CmdRunner, scratchpadPath string) (testfile1, testfile2 string, retErr error)
PrepareScratchpadAndTestFiles prepares the scratchpad space at ScratchpadPath by ensuring that it is empty before the test, and exists after the call. Also, this creates 2 test files in it for testing. The path to the 2 test files are returned, and err is nil iff the operation is successful. This is usually called at the start of pkcs#11 related tests.
func SetupP11TestToken ¶
SetupP11TestToken configures a PKCS #11 database in scratchpadPath.
func SignAndVerify ¶
func SignAndVerify(ctx context.Context, p *pkcs11.Chaps, key *pkcs11.KeyInfo, input, altInput string, mechanism *pkcs11.MechanismInfo) error
SignAndVerify is just a convenient runner to test both signing and verification. altInput is path to another test file that differs in content to input. It is used to check that verify() indeed reject corrupted input.
Types ¶
This section is empty.