crypto

package
v0.0.0-...-2034d43 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package crypto provides ECDSA key management and signature operations for SchemaPin.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyManager

type KeyManager struct{}

KeyManager handles ECDSA key operations

func NewKeyManager

func NewKeyManager() *KeyManager

NewKeyManager creates a new KeyManager instance

func (*KeyManager) CalculateKeyFingerprint

func (k *KeyManager) CalculateKeyFingerprint(key *ecdsa.PublicKey) (string, error)

CalculateKeyFingerprint computes SHA-256 fingerprint of public key

func (*KeyManager) CalculateKeyFingerprintFromPEM

func (k *KeyManager) CalculateKeyFingerprintFromPEM(publicKeyPEM string) (string, error)

CalculateKeyFingerprintFromPEM computes SHA-256 fingerprint from PEM-encoded public key

func (*KeyManager) ExportPrivateKeyPEM

func (k *KeyManager) ExportPrivateKeyPEM(key *ecdsa.PrivateKey) (string, error)

ExportPrivateKeyPEM exports private key to PEM format using PKCS#8

func (*KeyManager) ExportPublicKeyPEM

func (k *KeyManager) ExportPublicKeyPEM(key *ecdsa.PublicKey) (string, error)

ExportPublicKeyPEM exports public key to PEM format

func (*KeyManager) GenerateKeypair

func (k *KeyManager) GenerateKeypair() (*ecdsa.PrivateKey, error)

GenerateKeypair generates a new ECDSA key pair using P-256 curve

func (*KeyManager) LoadPrivateKeyPEM

func (k *KeyManager) LoadPrivateKeyPEM(pemData string) (*ecdsa.PrivateKey, error)

LoadPrivateKeyPEM loads private key from PEM format

func (*KeyManager) LoadPublicKeyPEM

func (k *KeyManager) LoadPublicKeyPEM(pemData string) (*ecdsa.PublicKey, error)

LoadPublicKeyPEM loads public key from PEM format

type SignatureManager

type SignatureManager struct{}

SignatureManager handles signature operations

func NewSignatureManager

func NewSignatureManager() *SignatureManager

NewSignatureManager creates a new SignatureManager instance

func (*SignatureManager) SignHash

func (s *SignatureManager) SignHash(hashBytes []byte, privateKey *ecdsa.PrivateKey) (string, error)

SignHash signs a hash with the private key and returns base64-encoded signature

func (*SignatureManager) SignSchemaHash

func (s *SignatureManager) SignSchemaHash(schemaHash []byte, privateKey *ecdsa.PrivateKey) (string, error)

SignSchemaHash signs a schema hash (convenience method)

func (*SignatureManager) VerifySchemaSignature

func (s *SignatureManager) VerifySchemaSignature(schemaHash []byte, signatureB64 string, publicKey *ecdsa.PublicKey) bool

VerifySchemaSignature verifies a schema signature (convenience method)

func (*SignatureManager) VerifySignature

func (s *SignatureManager) VerifySignature(hashBytes []byte, signatureB64 string, publicKey *ecdsa.PublicKey) bool

VerifySignature verifies a base64-encoded signature against a hash

Jump to

Keyboard shortcuts

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