ncrypt

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0, Apache-2.0 Imports: 14 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(
	issuerNames [][]byte, filterCallback func(*x509.Certificate) bool,
	storeName string, provider string,
) (*Key, error)

Cred returns a Key wrapping the first certificate in the system store matching one of the given issuerNames and satisfying the filterCallback.

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