Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Hardcoded "BC" provider name prevents use in FIPS environments #232

Copy link
Copy link
@tylerprete

Description

@tylerprete
Issue body actions

Problem

The library hardcodes "BC" as the JCE provider name in several getInstance() calls, which prevents it from working in FIPS (Federal Information Processing Standards) environments where the BouncyCastle FIPS provider ("BCFIPS") is registered instead of the standard provider ("BC").

Affected code

HttpEce.java — literal "BC" strings:

  • Cipher.getInstance("AES/GCM/NoPadding", "BC") (lines 68, 140)

Utils.java — uses BouncyCastleProvider.PROVIDER_NAME (which resolves to "BC"):

  • KeyFactory.getInstance(ALGORITHM, PROVIDER_NAME) (4 call sites)

The KeyAgreement.getInstance("ECDH") calls in HttpEce.java already omit the provider argument and would work fine in FIPS as-is.

Suggested fix

The standard JCE practice is to omit the provider argument and let the framework pick the best registered provider:

// Current — breaks in FIPS
Cipher.getInstance("AES/GCM/NoPadding", "BC")

// Option A — provider-agnostic (recommended if no BC-specific behavior is needed)
Cipher.getInstance("AES/GCM/NoPadding")

// Option B — configurable provider
Cipher.getInstance("AES/GCM/NoPadding", this.providerName)

The algorithms used (ECDH, AES-GCM, EC key generation on P-256) are all supported by standard JCE providers and by BCFIPS, so there is no technical reason to pin to "BC".

Option A is the simplest change. Option B (adding a setProvider(String) or constructor parameter) would give consumers explicit control.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.