func (s *StubCtx) OpenSession(slotID uint, flags uint) (pkcs11.SessionHandle, error) { err := s.checkErr("OpenSession") if err != nil { return pkcs11.SessionHandle(0), err } return s.ctx.OpenSession(slotID, flags) }
"crypto" "crypto/ecdsa" "crypto/rand" "crypto/rsa" "encoding/asn1" "github.com/miekg/pkcs11" "reflect" "strings" "testing" ) type mockCtx struct { currentSearch []*pkcs11.Attribute } const sessionHandle = pkcs11.SessionHandle(17) const rsaPrivateKeyHandle = pkcs11.ObjectHandle(23) // Correct EC private key const ecPrivateKeyHandle = pkcs11.ObjectHandle(32) const ecPublicKeyHandle = pkcs11.ObjectHandle(33) const ecCorrectKeyID = byte(0x03) // EC private key with no matching public key const ecPrivNoPubHandle = pkcs11.ObjectHandle(34) const ecPrivNoPubID = byte(0x4) // EC private and public key with invalid EC point const ecInvEcPointPrivHandle = pkcs11.ObjectHandle(35) const ecInvEcPointPubHandle = pkcs11.ObjectHandle(36) const ecInvEcPointID = byte(0x5)