Documentation
¶
Index ¶
Constants ¶
const ( FIPSKeyAlgorithmECCP521 = "ECC-P521" FIPSKeyAlgorithmRSA4096 = "RSA-4096" FIPSCipherAlgorithm = "AES-256-GCM" FIPSHashingAlgorithm = "SHA-512" FIPSMacAlgorithm = "HMAC-SHA-512" FIPSSignatureAlgorithm = "ECDSA" )
FIPS 140-3 compliant algorithm constants.
Variables ¶
This section is empty.
Functions ¶
func ExtractAlgorithmName ¶
ExtractAlgorithmName extracts the base algorithm name from a full algorithm string. Examples:
- "RSA-4096" -> "RSA"
- "ECC P-521" -> "ECC"
- "AES-256-GCM" -> "AES"
- "SHA-512" -> "SHA"
- "RSA" -> "RSA" (already clean)
func ExtractBitLength ¶
ExtractBitLength extracts the bit length from an algorithm name. Examples:
- "RSA-4096" -> 4096
- "RSA-3072" -> 3072
- "ECC P-521" -> 521
- "ECC P-256" -> 256
- "AES-256-GCM" -> 256
- "SHA-512" -> 512
Returns 0 if no bit length can be extracted.
func GetAlgorithmDetails ¶
GetAlgorithmDetails returns both name and bit length for an algorithm.
func ValidateFIPS140_3Compliance ¶
ValidateFIPS140_3Compliance checks if an algorithm is FIPS 140-3 compliant.
Types ¶
type AlgorithmValidator ¶
type AlgorithmValidator struct {
// contains filtered or unexported fields
}
AlgorithmValidator validates cryptographic algorithms against a policy. It can be used to enforce FIPS 140-3 compliance or custom algorithm policies.
func NewAlgorithmValidator ¶
func NewAlgorithmValidator( ciphers, hashing, mac, asymmetric, signature []string, ) AlgorithmValidator
NewAlgorithmValidator creates a new validator with the specified allowed algorithms.
func NewFIPSValidator ¶
func NewFIPSValidator() AlgorithmValidator
NewFIPSValidator creates a new validator enforcing FIPS 140-3 standards.
func (AlgorithmValidator) ValidateAsymmetric ¶
func (av AlgorithmValidator) ValidateAsymmetric(algo string) error
ValidateAsymmetric checks if an asymmetric algorithm is allowed.