algorithm

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package algorithm includes signature algorithms accepted by Notary Project

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Algorithm

type Algorithm int

Algorithm defines the signature algorithm.

const (
	AlgorithmPS256 Algorithm = 1 + iota // RSASSA-PSS with SHA-256
	AlgorithmPS384                      // RSASSA-PSS with SHA-384
	AlgorithmPS512                      // RSASSA-PSS with SHA-512
	AlgorithmES256                      // ECDSA on secp256r1 with SHA-256
	AlgorithmES384                      // ECDSA on secp384r1 with SHA-384
	AlgorithmES512                      // ECDSA on secp521r1 with SHA-512
)

Signature algorithms supported by this library.

Reference: https://github.com/notaryproject/notaryproject/blob/main/specs/signature-specification.md#algorithm-selection

func (Algorithm) Hash

func (alg Algorithm) Hash() crypto.Hash

Hash returns the hash function of the algorithm.

type KeySpec

type KeySpec struct {
	// KeyType is the type of the key.
	Type KeyType

	// KeySize is the size of the key in bits.
	Size int
}

KeySpec defines a key type and size.

func ExtractKeySpec

func ExtractKeySpec(signingCert *x509.Certificate) (KeySpec, error)

ExtractKeySpec extracts KeySpec from the signing certificate.

func (KeySpec) SignatureAlgorithm

func (k KeySpec) SignatureAlgorithm() Algorithm

SignatureAlgorithm returns the signing algorithm associated with the KeySpec.

type KeyType

type KeyType int

KeyType defines the key type.

const (
	KeyTypeRSA KeyType = 1 + iota // KeyType RSA
	KeyTypeEC                     // KeyType EC
)

Jump to

Keyboard shortcuts

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