Skip to content

Support encoding with different parameters (including modern algorithms, password-less)#48

Merged
AGWA merged 16 commits intomasterfrom
encoder
Oct 26, 2023
Merged

Support encoding with different parameters (including modern algorithms, password-less)#48
AGWA merged 16 commits intomasterfrom
encoder

Conversation

@AGWA
Copy link
Copy Markdown
Member

@AGWA AGWA commented Jul 14, 2023

Instead of calling pkcs12.Encode, you now call the Encode method of an Encoder (likewise for EncodeTrustStore and EncodeTrustStoreEntries) which specifies what algorithms/parameters you want to use.

The following Encoders are available:

cc @Marc-Pons, @pivotal-david-osullivan, @Tookmund, @maraino, @hslatman

AGWA added 3 commits July 13, 2023 18:49
Instead of calling pkcs12.Encode, call the Encode method of an Encoder.
(Likewise for EncodeTrustStore and EncodeTrustStoreEntries.)

The following Encoders are available:

* Legacy, for the current behavior.

* LegacyDESCerts, to use 3DES for encrypting certificates (Closes #36, Closes #35).

* Passwordless, to create password-less trust stores like Java 18 (Closes #10).

* Openssl3, to match OpenSSL's modern algorithm choices (Closes #47).

* Modern, to always use the most modern choices.
AGWA added 6 commits July 14, 2023 11:31
AGWA added 7 commits July 18, 2023 12:42
OpenSSL 3 and Java 20 use the same algorithms by default, but differ in
the number of KDF iterations and the KDF salt length.  This suggests that
there won't be any compatibility problems if I diverge from OpenSSL's
salt length.  Therefore, Modern2023 uses a salt length of 16.
@AGWA
Copy link
Copy Markdown
Member Author

AGWA commented Jul 21, 2023

Latest changes:

  • Replace rand argument with WithRand method on Encoder
  • Add WithIterations method to Encoder to customize KDF iterations
  • Replace Openssl3 encoder with Modern2023, since newer versions of Java and Windows also use these algorithms. Modern is an alias for Modern2023.
  • Add support for unencrypted PKCS#8 key bags, so that Passwordless can be used with Encode as well.

Testing and feedback much appreciated!

@modulo11
Copy link
Copy Markdown

I can confirm that the Passwordless encoder works well with the PKCS12 based keystores shipped with newer Java versions.

@dmikusa
Copy link
Copy Markdown

dmikusa commented Jul 26, 2023

+1 this is working for me as well.

@Marc-Pons
Copy link
Copy Markdown

LegacyDESCerts encodes is working as well, thanks @AGWA

@modulo11
Copy link
Copy Markdown

@AGWA when would you be confident to merge this? Really looking forward to it!

@DmytroShalaiev
Copy link
Copy Markdown

Any updates?

@AGWA AGWA merged commit 98b1ddc into master Oct 26, 2023
@AGWA AGWA deleted the encoder branch October 26, 2023 20:33
@AGWA
Copy link
Copy Markdown
Member Author

AGWA commented Oct 26, 2023

Thanks, everyone. I just merged the changes and released v0.3.0. I made the following last-minute API changes:

  • Rename LegacyDESCerts to LegacyDES
  • Rename Legacy to LegacyRC2
  • Add new Legacy that is an alias for LegacyDES

I discovered during testing that LegacyDES produces files that are more widely-supported than LegacyRC2 so it is the preferred legacy encoder to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support triple DES certificate encryption Encoding password-less PKCS12

6 participants