Documentation
¶
Overview ¶
Package utils provides cryptographic and general-purpose utility functions.
Index ¶
Constants ¶
View Source
const ( // PEMTypeRSAPrivateKey is the PEM block type for PKCS#1 RSA private keys. PEMTypeRSAPrivateKey = "RSA PRIVATE KEY" // PEMTypePrivateKey is the PEM block type for PKCS#8 private keys. PEMTypePrivateKey = "PRIVATE KEY" )
Variables ¶
View Source
var ( // ErrInvalidPrivateKey is returned when the PEM block cannot be // decoded or the key bytes are invalid. ErrInvalidPrivateKey = errors.New("failed to decode PEM block") // ErrNotRSAKey is returned when a PKCS#8 key is not an RSA private key. ErrNotRSAKey = errors.New("not an RSA private key") // ErrInvalidPEMType is returned when the PEM block type is not RSA PRIVATE KEY or PRIVATE KEY. ErrInvalidPEMType = errors.New("unexpected PEM block type") )
Functions ¶
func HashString ¶
HashString returns the SHA-256 hex digest of a string, prefixed with "sha256:" to identify the algorithm used.
func ParseRSAPrivateKey ¶
func ParseRSAPrivateKey(pemStr string) (*rsa.PrivateKey, error)
ParseRSAPrivateKey decodes a PEM-encoded RSA private key. It supports both PKCS#1 (RSA PRIVATE KEY) and PKCS#8 (PRIVATE KEY) formats.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.