e2e

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2025 License: MIT Imports: 16 Imported by: 0

README

e2e test

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BenchmarkAESCipher

func BenchmarkAESCipher(t *testing.T, ctx *TestContext)

BenchmarkAESCipher runs performance benchmarks for AES cipher operations

func RunCipherTests

func RunCipherTests(t *testing.T, ctx *TestContext)

RunCipherTests runs the complete suite of cipher tests

func RunKeypairTests

func RunKeypairTests(t *testing.T, ctx *TestContext)

RunKeypairTests runs the complete suite of keypair tests

func RunSymmetricKeyTests

func RunSymmetricKeyTests(t *testing.T, ctx *TestContext)

RunSymmetricKeyTests runs the complete suite of symmetric key tests

func RunTokenTests

func RunTokenTests(t *testing.T, ctx *TestContext)

RunTokenTests runs the complete suite of token functionality tests

func TestAESCBCCipher

func TestAESCBCCipher(t *testing.T, ctx *TestContext)

TestAESCBCCipher tests AES-CBC cipher functionality

func TestAESCipherErrorCases

func TestAESCipherErrorCases(t *testing.T, ctx *TestContext)

TestAESCipherErrorCases tests various error scenarios

func TestAESCipherProperties

func TestAESCipherProperties(t *testing.T, ctx *TestContext)

TestAESCipherProperties tests cipher properties and configuration

func TestAESConcurrencyAndCancellation

func TestAESConcurrencyAndCancellation(t *testing.T, ctx *TestContext)

TestAESConcurrencyAndCancellation tests concurrent operations and context cancellation

func TestAESECBCipher

func TestAESECBCipher(t *testing.T, ctx *TestContext)

TestAESECBCipher tests AES-ECB cipher functionality

func TestAESGCMCipher

func TestAESGCMCipher(t *testing.T, ctx *TestContext)

TestAESGCMCipher tests AES-GCM cipher functionality

func TestDeleteSymmetricKey

func TestDeleteSymmetricKey(t *testing.T, ctx *TestContext)

TestDeleteSymmetricKey tests symmetric key deletion

func TestECDSAKeypairs

func TestECDSAKeypairs(t *testing.T, ctx *TestContext)

TestECDSAKeypairs runs ECDSA-specific keypair tests

func TestED25519Keypairs

func TestED25519Keypairs(t *testing.T, ctx *TestContext)

TestED25519Keypairs runs ED25519-specific keypair tests

func TestGenerate3DESKey

func TestGenerate3DESKey(t *testing.T, ctx *TestContext)

TestGenerate3DESKey tests 3DES key generation

func TestGenerateAESKey

func TestGenerateAESKey(t *testing.T, ctx *TestContext)

TestGenerateAESKey tests AES key generation with various key sizes

func TestGenerateDESKey

func TestGenerateDESKey(t *testing.T, ctx *TestContext)

TestGenerateDESKey tests DES key generation

func TestGetSymmetricKey

func TestGetSymmetricKey(t *testing.T, ctx *TestContext)

TestGetSymmetricKey tests retrieving symmetric keys by ID

func TestImport3DESKey

func TestImport3DESKey(t *testing.T, ctx *TestContext)

TestImport3DESKey tests 3DES key import

func TestImportAESKey

func TestImportAESKey(t *testing.T, ctx *TestContext)

TestImportAESKey tests AES key import with various key sizes

func TestImportDESKey

func TestImportDESKey(t *testing.T, ctx *TestContext)

TestImportDESKey tests DES key import

func TestKeypairAsDecrypter

func TestKeypairAsDecrypter(t *testing.T, ctx *TestContext)

TestKeypairAsDecrypter tests crypto.Decrypter interface implementation

func TestKeypairAsSigner

func TestKeypairAsSigner(t *testing.T, ctx *TestContext)

TestKeypairAsSigner tests crypto.Signer interface implementation

func TestKeypairConcurrentAccess

func TestKeypairConcurrentAccess(t *testing.T, ctx *TestContext)

TestKeypairConcurrentAccess tests concurrent access to keypair methods

func TestKeypairEdgeCases

func TestKeypairEdgeCases(t *testing.T, ctx *TestContext)

TestKeypairEdgeCases tests edge cases in keypair handling

func TestKeypairFieldValidation

func TestKeypairFieldValidation(t *testing.T, ctx *TestContext)

TestKeypairFieldValidation tests that keypair fields are properly populated

func TestKeypairGeneration

func TestKeypairGeneration(t *testing.T, ctx *TestContext)

TestKeypairGeneration tests basic keypair generation for all supported types

func TestKeypairIDHexEncoding

func TestKeypairIDHexEncoding(t *testing.T, ctx *TestContext)

TestKeypairIDHexEncoding tests hex encoding of keypair IDs

func TestKeypairPublic

func TestKeypairPublic(t *testing.T, ctx *TestContext)

TestKeypairPublic tests public key extraction from keypairs

func TestKeypairString

func TestKeypairString(t *testing.T, ctx *TestContext)

TestKeypairString tests string representation of keypairs

func TestListSymmetricKeys

func TestListSymmetricKeys(t *testing.T, ctx *TestContext)

TestListSymmetricKeys tests listing all symmetric keys

func TestNewToken

func TestNewToken(t *testing.T, ctx *TestContext)

TestNewToken tests token creation with various configurations

func TestRSAKeypairs

func TestRSAKeypairs(t *testing.T, ctx *TestContext)

TestRSAKeypairs runs RSA-specific keypair tests

func TestSlotIdentificationTypeString

func TestSlotIdentificationTypeString(t *testing.T, ctx *TestContext)

TestSlotIdentificationTypeString tests slot identification type string representation

func TestSymmetricKeyAttributeValidation

func TestSymmetricKeyAttributeValidation(t *testing.T, ctx *TestContext)

TestSymmetricKeyAttributeValidation tests symmetric key attribute validation

func TestSymmetricKeyConcurrentOperations

func TestSymmetricKeyConcurrentOperations(t *testing.T, ctx *TestContext)

TestSymmetricKeyConcurrentOperations tests concurrent symmetric key operations

func TestSymmetricKeyErrorCases

func TestSymmetricKeyErrorCases(t *testing.T, ctx *TestContext)

TestSymmetricKeyErrorCases tests error handling scenarios

func TestSymmetricKeyFilteredListing

func TestSymmetricKeyFilteredListing(t *testing.T, ctx *TestContext)

TestSymmetricKeyFilteredListing tests filtered listing of symmetric keys

func TestSymmetricKeyImportExportWorkflow

func TestSymmetricKeyImportExportWorkflow(t *testing.T, ctx *TestContext)

TestSymmetricKeyImportExportWorkflow tests import/export workflow

func TestSymmetricKeyLifecycle

func TestSymmetricKeyLifecycle(t *testing.T, ctx *TestContext)

TestSymmetricKeyLifecycle tests complete symmetric key lifecycle

func TestSymmetricKeyString

func TestSymmetricKeyString(t *testing.T, ctx *TestContext)

TestSymmetricKeyString tests string representation of symmetric keys

func TestSymmetricKeyWithCustomAttributes

func TestSymmetricKeyWithCustomAttributes(t *testing.T, ctx *TestContext)

TestSymmetricKeyWithCustomAttributes tests keys with custom attributes

func TestTokenAttributeHelpers

func TestTokenAttributeHelpers(t *testing.T, ctx *TestContext)

TestTokenAttributeHelpers tests attribute helper functions

func TestTokenClose

func TestTokenClose(t *testing.T, ctx *TestContext)

TestTokenClose tests token close functionality

func TestTokenConcurrentAccess

func TestTokenConcurrentAccess(t *testing.T, ctx *TestContext)

TestTokenConcurrentAccess tests concurrent access to token methods

func TestTokenConnectionState

func TestTokenConnectionState(t *testing.T, ctx *TestContext)

TestTokenConnectionState tests connection state management

func TestTokenErrorHandling

func TestTokenErrorHandling(t *testing.T, ctx *TestContext)

TestTokenErrorHandling tests token error handling scenarios

func TestTokenLifecycle

func TestTokenLifecycle(t *testing.T, ctx *TestContext)

TestTokenLifecycle tests complete token lifecycle

func TestTokenMemoryManagement

func TestTokenMemoryManagement(t *testing.T, ctx *TestContext)

TestTokenMemoryManagement tests memory management during token operations

func TestTokenSessionManagement

func TestTokenSessionManagement(t *testing.T, ctx *TestContext)

TestTokenSessionManagement tests session-related functionality

Types

type CommonTestConfig

type CommonTestConfig struct {
	// Skip specific test categories based on HSM capabilities
	SkipConcurrencyTests bool
	SkipLargeDataTests   bool
	SkipPerformanceTests bool

	// Test size limits for different HSMs
	MaxTestDataSize  int
	MaxConcurrentOps int

	// Supported key sizes and algorithms
	SupportedRSAKeySizes []int
	SupportedAESKeySizes []int
	SupportedECDSACurves []string
	SupportedCipherModes []string
}

CommonTestConfig holds configuration options for common tests

func DefaultCommonTestConfig

func DefaultCommonTestConfig() *CommonTestConfig

DefaultCommonTestConfig returns a default configuration suitable for most HSMs

type HSMTestSuite

type HSMTestSuite interface {
	CreateToken(t testing.TB) *gopkcs11.Token
	Cleanup() error
}

HSMTestSuite defines the interface that HSM-specific implementations must satisfy to run the common e2e test suite.

type TestContext

type TestContext struct {
	HSM    HSMTestSuite
	Config *CommonTestConfig
}

TestContext bundles the HSM test suite with configuration for running tests

func NewTestContext

func NewTestContext(hsm HSMTestSuite, config *CommonTestConfig) *TestContext

NewTestContext creates a new test context with the given HSM suite and optional config

func (*TestContext) CreateTestToken

func (ctx *TestContext) CreateTestToken(t testing.TB) *gopkcs11.Token

CreateTestToken is a convenience method that creates a test token using the HSM suite

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL