func ParseHexString(str string) (i uint32, err error)
ParseHexString parses hexadecimal string into uint32
Key is a wrapper around the pkcs11 module and uses it to implement signing-related methods.
type Key struct {
// contains filtered or unexported fields
}
func Cred(pkcs11Module string, slotUint32Str string, label string, userPin string) (*Key, error)
Cred returns a Key wrapping the first valid certificate in the pkcs11 module matching a given slot and label.
func (k *Key) CertificateChain() [][]byte
CertificateChain returns the credential as a raw X509 cert chain. This contains the public key.
func (k *Key) Close()
Close releases resources held by the credential.
func (k *Key) Decrypt(msg []byte, opts crypto.DecrypterOpts) ([]byte, error)
Decrypt decrypts a ciphertext message digest using the private key. Here, we pass off the decryption to pkcs11 library.
func (k *Key) Encrypt(plaintext []byte, opts any) ([]byte, error)
Encrypt encrypts a plaintext message digest using the public key. Here, we use standard golang API.
func (k *Key) Public() crypto.PublicKey
Public returns the corresponding public key for this Key.
func (k *Key) Sign(_ io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error)
Sign signs a message.