Skip to content

Support for PEM encoded encrypted private key #47370

@AlexMeyerPMU

Description

@AlexMeyerPMU

At the moment, when using spring.ssl.bundle.pem property with PEM encoded content, it works fine with what is defined in the PemPrivateKeyParser.java class.

Headers and footers defined as PKCS1_RSA_HEADER and PKCS1_RSA_FOOTER, PKCS8_HEADER and PKCS8_FOOTER, PKCS8_ENCRYPTED_HEADER and PKCS8_ENCRYPTED_FOOTER, SEC1_EC_HEADER and SEC1_EC_FOOTER.

However, most of the time we will have encrypted private keys that does not fit in those predefined keys.

Here is an example of the begining of the key which can be defined as PKCS1 ENCRYPTED I guess.

-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-256-CBC,XXXXXXXXXXXXXXXXXXXXXXXX

When using those types of keys, I get the following error:

"Missing private key or unrecognized format"

Which is thrown from the PemPrivateKeyParser class.

I think the parser cannot parse the two lines after the header.

It would be nice if you could had support for this type of private keys in a near future.

Thank you very much.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions