TheWaWaR / TheWaWaR/simple-http-server

MAC verification always failed for PKCS12 cert

Open
#115 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
3.5k
Forks
219
PR merge metrics
No merged PRs in 30d

Description

I generated the PKCS12 cert by using these commands:

openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -nodes -subj "/CN=mydev.local"

and

openssl pkcs12 -export -out mydev.local.p12 -inkey key.pem -in cert.pem -name "mydev.local"

with manually input password abcd1234.

But when running simple-http-server, it failed.

simple-http-server --cert mydev.local.p12 --certpass abcd1234

The output is:

thread 'main' panicked at /Users/qdwang/.cargo/registry/src/index.crates.io-6f17d22bba15001f/simple-http-server-0.6.8/src/main.rs:387:70:
called `Result::unwrap()` on an `Err` value: Tls(Error { code: -25264, message: "MAC verification failed during PKCS12 import (wrong password?)" })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the OpenSSL commands and the simple-http-server invocation from the issue. Start at src/main.rs:387, where the PKCS12 certificate handling panics, and inspect the certificate-loading path. Done means the generated .p12 file and supplied password no longer produce a MAC verification error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.