golang/go · error
crypto/des: use of TripleDES is not allowed in FIPS 140-only
Error message
crypto/des: use of TripleDES is not allowed in FIPS 140-only mode
What it means
In FIPS 140-only mode, the des package refuses to construct a TripleDES (3DES) cipher. Although stronger than single DES, 3DES is deprecated and not approved for new FIPS use, so NewTripleDESCipher short-circuits before key-length validation.
Source
Thrown at src/crypto/des/cipher.go:81
}
if len(dst) < BlockSize {
panic("crypto/des: output not full block")
}
if alias.InexactOverlap(dst[:BlockSize], src[:BlockSize]) {
panic("crypto/des: invalid buffer overlap")
}
cryptBlock(c.subkeys[:], dst, src, true)
}
// A tripleDESCipher is an instance of TripleDES encryption.
type tripleDESCipher struct {
cipher1, cipher2, cipher3 desCipher
}
// NewTripleDESCipher creates and returns a new [cipher.Block].
func NewTripleDESCipher(key []byte) (cipher.Block, error) {
if fips140only.Enforced() {
return nil, errors.New("crypto/des: use of TripleDES is not allowed in FIPS 140-only mode")
}
if len(key) != 24 {
return nil, KeySizeError(len(key))
}
c := new(tripleDESCipher)
c.cipher1.generateSubkeys(key[:8])
c.cipher2.generateSubkeys(key[8:16])
c.cipher3.generateSubkeys(key[16:])
return c, nil
}
func (c *tripleDESCipher) BlockSize() int { return BlockSize }
func (c *tripleDESCipher) Encrypt(dst, src []byte) {
if len(src) < BlockSize {
panic("crypto/des: input not full block")View on GitHub (pinned to b6b368adc5)
Solutions
- Migrate to AES (aes.NewCipher) for all new encryption.
- If FIPS-only is not required, rebuild the binary without FIPS 140-only enforcement.
- For existing 3DES data, decrypt in a non-FIPS context and re-encrypt with AES.
Example fix
// before block, err := des.NewTripleDESCipher(key24) // after block, err := aes.NewCipher(key16)
Defensive patterns
Strategy: validation
Validate before calling
func newBlock(key []byte) (cipher.Block, error) {
if fipsEnabled() {
return nil, errors.New("TripleDES is unavailable in FIPS-only mode; configure AES")
}
return des.NewTripleDESCipher(key)
} Try / catch
block, err := des.NewTripleDESCipher(key)
if err != nil && strings.Contains(err.Error(), "FIPS 140-only mode") {
// migrate to AES or rebuild without FIPS-only mode
} Prevention
- Treat 3DES as deprecated; plan migration to AES.
- Gate legacy-crypto paths behind a feature flag so they can be disabled in FIPS builds.
- Run a crypto audit when adopting a FIPS toolchain.
When it happens
Trigger: Calling des.NewTripleDESCipher(key) in a binary with FIPS 140-only enforcement enabled.
Common situations: Legacy systems using 3DES (e.g. older TLS/JCE/PKCS interop) moved into a FIPS-regulated runtime; FIPS toolchain build picked up by CI without crypto audit.
Related errors
- crypto/des: use of DES is not allowed in FIPS 140-only mode
- crypto/dsa: use of DSA is not allowed in FIPS 140-only mode
- crypto/ecdh: only crypto/rand.Reader is allowed in FIPS 140-
- crypto/ecdh: use of X25519 is not allowed in FIPS 140-only m
- crypto/ecdsa: use of custom curves is not allowed in FIPS 14
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/d1e581a7a3f218aa.
Report an issue: GitHub.