`CertifiedIssuer::from_ca_cert_{pem,der}`?
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- rust
- Domain
- cryptography, security
Research direction
Start by comparing CertifiedIssuer with Issuer and the existing Issuer::from_ca_cert_pem and Issuer::from_ca_cert_der APIs. Trace the rcgen-0.13 example in the issue and determine how equivalent PEM and DER loading should expose the existing issuer certificate; done means both requested CertifiedIssuer constructors support the described workflow without the self-signing workaround.
Written by the indexing model from the issue text.
Description
While upgrading from 0.13 to 0.14, I ran into some difficulties trying to keep the old functionality. Specifically, I would like to have access to the issuer certificate while generating a leaf certificate.
Scouring the changelogs and documentation, I did find CertifiedIssuer which seems to be what I need. Unfortunately I couldn't find a way to load an existing certificate like you can with Issuer (Issuer::from_ca_cert_{pem,der}). So here's the feature request.
Here's a slimmed-down version of my current code using rcgen-0.13:
fn main() -> Result<()> {
let issuer = load_issuer("path/to/issuer.crt", "path/to/issuer.key")?;
let leaf = generate(&issuer)?;
dbg!(leaf);
}
fn load_issuer(cert_pem: &str, key_pem: &str) -> Result<CertifiedKey> {
let key_pair = KeyPair::from_pem(key_pem)?;
let cert = {
let mut params = CertificateParams::from_ca_cert_pem(cert_pem)?;
// https://github.com/rustls/rcgen/issues/274#issuecomment-2121969453
params.self_signed(&key_pair)?
};
// various checks omitted here ...
Ok(CertifiedKey { cert, key_pair })
}
pub fn generate(issuer: &CertifiedKey) -> Result<CertifiedKey> {
let params = {
let issuer_params = issuer.cert.params();
let mut params = CertificateParams::new([])?;
// set certificate expiry to match issuer
params.not_before = issuer_params.not_before;
params.not_after = issuer_params.not_after;
// set other certificate params ...
params
};
let key_pair = KeyPair::generate_for(&PKCS_ED25519)?;
let cert = params.signed_by(&key_pair, &issuer.cert, &issuer.key_pair)?;
Ok(CertifiedKey { cert, key_pair })
}
I would like to update load_issuer to return a CertifiedIssuer (and ideally get rid of the self-signing hack), so that I can read from the issuer certificate in generate. But without CertifiedIssuer::from_ca_cert_{pem,der} I don't think it's possible.
- Dominant language
- Rust
- Stars
- 516
- Forks
- 160
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rustls/rcgen
-
Tighten up CertificateSigningRequestParams.from_der() sig AlgorithmIdentifier params validationOpennext-major-release
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
-
CertificateSigningRequestParams::from_der can parse the wrong key typePossibly taken @jgreeer claimed this 51 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Eyevinn/open-live-ingest#36 · 1 comment ·
Maintainers usually reply within 1 day
-
app
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
bug bug jury peripheral:i2s
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
esp-rs/esp-hal#6828 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
ライブラリを追加Openpriority middle
Difficulty 1/5 Under an hour Newbie friendliness 62/100
KATO-Hiro/AtCoderClans#13015 ·
Maintainers usually reply within 1 day