Skip to content

scepclient: add -encryption-algorithm flag for PKCS#7 envelope - #252

Open
afterdesign wants to merge 1 commit into
micromdm:mainfrom
afterdesign:feat/encryption-algorithm-flag
Open

afterdesign wants to merge 1 commit into
micromdm:mainfrom
afterdesign:feat/encryption-algorithm-flag

Conversation

@afterdesign

Copy link
Copy Markdown

Summary

Adds a new -encryption-algorithm flag to scepclient that selects the PKCS#7 content encryption algorithm used for the request envelope.

  • Supported values: des, aes128, aes256, aes128gcm, aes256gcm.
  • The default stays des (single DES-CBC), so existing behavior is unchanged and this is a non-breaking, additive change.
  • AES variants allow the client to interoperate with modern CAs that reject DES. For example, AWS Private CA Connector for SCEP rejects single DES-CBC with Unsupported algorithm: 1.3.14.3.2.7.

Changes

  • cmd/scepclient/scepclient.go: add the -encryption-algorithm flag and map it to pkcs7.ContentEncryptionAlgorithm.
  • go.mod: promote github.com/smallstep/pkcs7 to a direct dependency (already present transitively via smallstep/scep; go.sum unchanged).
  • README.md: document the new flag in the client help listing and add an explanatory section.

Test plan

  • go build ./... passes
  • go test ./... passes
  • gofmt clean
  • Manual: enroll against a CA that requires AES (e.g. AWS Private CA Connector for SCEP) using -encryption-algorithm=aes128
  • Manual: confirm default (des) still works against an existing DES-based server

Add a -encryption-algorithm flag to select the PKCS#7 content encryption
algorithm (des|aes128|aes256|aes128gcm|aes256gcm) for the request envelope.
The default stays des to preserve existing behavior; AES variants let the
client interoperate with modern CAs (e.g. AWS Private CA Connector for SCEP)
that reject single DES-CBC with "Unsupported algorithm: 1.3.14.3.2.7".

Promote github.com/smallstep/pkcs7 to a direct dependency and document the
flag in the README.
@sleventyeleven

Copy link
Copy Markdown

I'm also currently soft blocked by this exact same issue, requiring me to patch my own set of releases for compatibility with AWS SCEP Connector.

I've tested this version and closed my redundant PR as it does work as expected with -encryption-algorithm aes256

One thing worth noting for anyone else testing this: AWS's Connector for SCEP reliably fails the first PKIOperation of any fresh request with an unrelated The certificate included in the request is expired error, then succeeds on an identical retry a few seconds later. But I think this is an AWS-side quirk with syncing and completely unrelated to this PR.

sleventyeleven added a commit to sleventyeleven/Device-Trust-Cloud that referenced this pull request Aug 27, 2026
Adds a second, independent Terraform root (aws/) that builds the same
device trust pattern on AWS: an AWS Private CA root + intermediate CA,
and AWS Private CA's fully managed Connector for SCEP as the SCEP front
end - no step-ca VM or custom load balancer needed on this side, since
AWS runs the SCEP protocol implementation itself. The mtls_test_gateway
module is ported as-is (same nginx config, same ssl_verify_client
pattern) to verify enrolled AWS-issued certificates actually work for
TLS ClientAuth, matching the GCP side's own verification gateway.

Getting real enrollment working required two fixes, both implemented in
all three install scripts:
- scepclient hardcodes DES-CBC for the SCEP request's content encryption,
  which AWS's Connector for SCEP rejects outright. The scripts now fetch
  scepclient from a patched fork (sleventyeleven/scep, tracking upstream
  community PR micromdm/scep#252) that adds a -encryption-algo flag,
  defaulting to DES-CBC so the GCP path is unaffected.
- AWS's Connector for SCEP can reject a PKIOperation submitted too soon
  after the request's self-signed signer certificate is generated. All
  three scripts now retry once automatically (reusing the same cached
  CSR/key, not regenerating), which reliably resolves it.

Also fixes two real bugs surfaced during testing against the new AWS
path: install-windows.bat/install-macos.sh were still passing the old
-dnsname flag after the scepclient fork picked up an upstream
dnsnames/ipaddresses change, and install-windows.ps1 left
-Country/-Organization/-Ou with no default, which under PowerShell's
known empty-argument-dropping behavior when calling a native executable
could silently shift -encryption-algo's own value out of the argument
list.

Restructures Readme.md to stay high-level (architecture, quick start,
enrollment) with GCP-specific and AWS-specific detail, troubleshooting,
and known limitations split into docs/gcp-details.md and
docs/aws-details.md respectively.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants