ncrypt

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Rendered for windows/amd64

Overview

Package ncrypt provides wrappers around ncrypt.h functions. https://docs.microsoft.com/en-us/windows/win32/api/ncrypt/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SignHash

func SignHash(priv windows.Handle, pub crypto.PublicKey, digest []byte, opts crypto.SignerOpts) ([]byte, error)

SignHash is a wrapper for the NCryptSignHash function that supports only a subset of well-supported cryptographic primitives.

Signature algorithms: ECDSA, RSA. Hash functions: SHA-256. RSA schemes: RSASSA-PKCS1 and RSASSA-PSS.

https://docs.microsoft.com/en-us/windows/win32/api/ncrypt/nf-ncrypt-ncryptsignhash

Types

type Key

type Key struct {
	// contains filtered or unexported fields
}

Key is a wrapper around the certificate store and context that uses it to implement signing-related methods with CryptoNG functionality.

func Cred

func Cred(issuer string, storeName string, provider string) (*Key, error)

Cred returns a Key wrapping the first valid certificate in the system store matching a given issuer string.

func (*Key) CertificateChain

func (k *Key) CertificateChain() [][]byte

CertificateChain returns the credential as a raw X509 cert chain. This contains the public key.

func (*Key) Close

func (k *Key) Close() error

Close releases resources held by the credential.

func (*Key) Public

func (k *Key) Public() crypto.PublicKey

Public returns the corresponding public key for this Key.

func (*Key) Sign

func (k *Key) Sign(_ io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error)

Sign signs a message digest. Here, we pass off the signing to the Windows CryptoNG library.

Jump to

Keyboard shortcuts

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