Code Monkey home page Code Monkey logo

Comments (16)

shred avatar shred commented on June 8, 2024 1

Just after the unit tests are completed. Hopefully next week.

from acme4j.

shred avatar shred commented on June 8, 2024

Thank you... Yes, S/MIME validation and signature should be part of acme4j. I will have a look into that.

from acme4j.

shred avatar shred commented on June 8, 2024

In v2.15 I released today, S/MIME signature validation and header protection checks are now available, see the documentation.

I'm sorry that it took so long. There were technical and also personal problems that have been resolved by now.

from acme4j.

augjoh avatar augjoh commented on June 8, 2024

@shred : Thanks for adding this feature to acme4j πŸ‘. Unfortunately I wasn't able to use it as is. There are some obstacles to overcome. Perhaps you can shed some light on this and pin the errors.

The first point is a question about the signCert needed to verify the incoming email. Where do I get this certificate from? I assume, that it is the signer certificate of the challenge, but if so, how do I specify intermediate CA certificates? Regarding RFC8550:

Sending agents SHOULD include any certificates for the user's public
key(s) and associated issuer certificates. This increases the
likelihood that the intended recipient can establish trust in the
originator's public key(s).

So I suppose it is safe to assume, that a CA include all certificates (except the root certificate of he chain) to verify the incoming challenge email. The root certificate should be part of java's truststore, I guess. Perhaps you can sort out the certificates inside acme4j.

The second point is, that I can't see, why the following S/MIME challenge cannot be processed with acme4j regardless of the strict setting. Both invocations of the code snippet from the documentation, throw org.shredzone.acme4j.smime.exception.AcmeInvalidMessageException: Invalid S/MIME mail.

Please have a look at the following challenge email:

Return-Path: <[email protected]>
X-Original-To: [email protected]
Delivered-To: [email protected]
Received: from [127.0.0.1] (acme-ca-02.dc-bsd.my.corp [10.70.15.231])
	by mail.dc-bsd.my.corp (Postfix) with ESMTP id 0119D9CC22
	for <[email protected]>; Sat, 26 Nov 2022 21:09:39 +0000 (UTC)
Content-Type: multipart/signed; protocol="application/pkcs7-signature";
 micalg=sha256; boundary="--_NmP-1d902f4d1e8a735a-Part_1"
Auto-Submitted: auto-generated; type=acme
From: [email protected]
To: [email protected]
Subject: ACME: ABxfL5s4bjvmyVRvl6y-Y_GhdzTdWpKqlmrKAIVe
Message-ID: <[email protected]>
Date: Sat, 26 Nov 2022 21:09:38 +0000
MIME-Version: 1.0

----_NmP-1d902f4d1e8a735a-Part_1
Content-Type: multipart/alternative;
 boundary="--_NmP-1d902f4d1e8a735a-Part_2"

----_NmP-1d902f4d1e8a735a-Part_2
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<html><p>This is an automatically generated ACME challenge for email =
address <em>[email protected]</em>. If you haven't requested an S/MIME =
certificate generation for this email address, be very afraid. If you did =
request it, your email client might be able to process this request =
automatically, or you might have to paste the first token part into an =
external program.</p> <p>Please reply to this mail and fill out the =
following template: <pre>-----BEGIN ACME RESPONSE-----
&lt;fill in challengeResponse here&gt;
-----END ACME RESPONSE-----
</pre>Use the value of the following calculation inside the ACME response:
<pre>  token =3D (decodeBase64url(token-part1) || decodeBase64url(token-par=
t2))
  keyAuthorization =3D base64url(token) || '.' || base64url(Thumbprint(acco=
untKey))
  challengeResponse =3D base64url(SHA256(keyAuthorization))
</pre>Where can I find all the ingredients for this?<ul><li>token-part1 is =
in the subject of this email after 'ACME: ',</li><li>token-part2 can be =
found in your challenge request (over https),</li><li>accountKey has been =
generated in your ACME client.</li></ul></p></html>
----_NmP-1d902f4d1e8a735a-Part_2
Content-Type: application/json; charset=utf8
Content-Encoding: utf8

{ "token-part1": "001c5f2f9b386e3be6c9546f97acbe63f1a17734dd5a92aa966aca00855e" }
----_NmP-1d902f4d1e8a735a-Part_2--

----_NmP-1d902f4d1e8a735a-Part_1
Content-Type: application/pkcs7-signature; name=smime.p7s
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=smime.p7s

MIIUXQYJKoZIhvcNAQcCoIIUTjCCFEoCAQExDzANBglghkgBZQMEAgEFADCCBkkGCSqGSIb3DQEH
AaCCBjoEggY2Q29udGVudC1UeXBlOiBtdWx0aXBhcnQvYWx0ZXJuYXRpdmU7DQogYm91bmRhcnk9
Ii0tX05tUC0xZDkwMmY0ZDFlOGE3MzVhLVBhcnRfMiINCg0KLS0tLV9ObVAtMWQ5MDJmNGQxZ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vRe07dMApkJImlSxnOB5Lp/06a14YvAu/rGdmTIAZjeuXV
VPxo+urSTUj4dZB26HNKHyUwXvKWgIhfwlrc/kK+sXyYXk8cNNtAuOQlTJyU1B1NG5nFKTi4UOZI
9B1Lc0MktnrAntB70bOVcT0Lz5Qgslc8jwIUePJLyGKohKTe/744QPqZAz7nQaXS9E30yd1oTB7I
FH4Fg9GjWnD8rLvdCR/S54zEqsdIX/YCmky5DzyjLthY1Al4AJwaodd5gPQn2xhtkxssHLg48/X+
3Se+JTyad6MXmMixnlJFL8DoL8r/BcfZbT4b8oLWMrbURooMPVnxYbTx67IOGxuIYFolM9d9F39P
GBcFkTGIbcVUOIyV2vGH0fXOiVx4ktm4j3Ds843KZ8hj52SZr7RBAsgileucs713UOjfhrQqkbZh
nF5r9fOKs8ky8tSePQ8izk/jXC6PY5D7xyELoPrh
----_NmP-1d902f4d1e8a735a-Part_1--

It verifies fine with openssl(1) (1.1.1o) (and Thunderbird):

% openssl cms -in acme-challenge.eml -verify -CAfile RootCA2022G1.crt > /dev/null
Verification successful

The root of the CA hierarchy is:

% cat RootCA2022G1.crt 
-----BEGIN CERTIFICATE-----
MIICMjCCAbigAwIBAgIUVFHxn92JLMvpvng1h2Zw/RtpmegwCgYIKoZIzj0EAwMw
STELMAkGA1UEBhMCSlAxDjAMBgNVBAcMBVRva2lvMRAwDgYDVQQKDAdNeS5Db3Jw
MRgwFgYDVQQDDA9Sb290IENBIDIwMjIgRzEwHhcNMjIxMTI0MjEzNjQxWhcNMzIx
MTIzMjEzNjQwWjBJMQswCQYDVQQGEwJKUDEOMAwGA1UEBwwFVG9raW8xEDAOBgNV
BAoMB015LkNvcnAxGDAWBgNVBAMMD1Jvb3QgQ0EgMjAyMiBHMTB2MBAGByqGSM49
AgEGBSuBBAAiA2IABPOY6vOhMPItGqUJvY4lkfzze/PPJU0+kI7hapoX1x5GgfxV
c7JQ+0PyyxuUp5t22ygksHbgZgDhclC1CcEh2B4G51SjG0UZUnCFkjHCpiz+Ww1z
ZOSZijve1V3mjG9kqqNhMF8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
AYYwEQYDVR0gBAowCDAGBgRVHSAAMCkGA1UdDgQiBCDEapMYWVIm0/jytUt7Ixzn
xMhvlZYL+YFbgApzQ6YibTAKBggqhkjOPQQDAwNoADBlAjEAiJVdY293qebKtBT2
JMzLcJ+0orgNZKj6dj6hrRFUUWDh0uWMTStWcSAAXmWjhhEvAjAn70Kx7WBOKvhb
5TPdIh9chDFczoiSPhneLLwQiroxL3mGA5tX1rOCE19lACe7N7c=
-----END CERTIFICATE-----

from acme4j.

shred avatar shred commented on June 8, 2024

So I suppose it is safe to assume, that a CA include all certificates (except the root certificate of he chain) to verify the incoming challenge email. The root certificate should be part of java's truststore, I guess. Perhaps you can sort out the certificates inside acme4j.

The original idea was that the CA's signing key must be fetched from the CA before, and then passed in as a separate argument. But you are right, acme4j should use and verify the given signature key. I will add that.

The second point is, that I can't see, why the following S/MIME challenge cannot be processed with acme4j regardless of the strict setting.

RFC8823 says that "Either way, [the challenge message] MUST use S/MIME header protection." (3.1. point 7). More about header protection can be found here. acme4j expects the "wrapped message" header protection. This is, the signed part of the message must be an RFC822 message by itself, so the mail headers are part of the signature. In your example mail, the signed body is just plain Content-Type: text/html. acme4j refuses to process this mail because there are no protected headers.

from acme4j.

augjoh avatar augjoh commented on June 8, 2024

Indeed, the headers are needed. Please find the secured header fields inside the smime.p7s:

 4650:d=6  hl=3 l= 161 cons:       SEQUENCE          
 4653:d=7  hl=2 l=  11 prim:        OBJECT            :1.2.840.113549.1.9.16.2.55
 4666:d=7  hl=3 l= 145 cons:        SET               
 4669:d=8  hl=3 l= 142 cons:         SET               
 4672:d=9  hl=2 l=   1 prim:          ENUMERATED        :01
 4675:d=9  hl=3 l= 136 cons:          SEQUENCE          
 4678:d=10 hl=2 l=  60 cons:           SEQUENCE          
 4680:d=11 hl=2 l=   7 prim:            VISIBLESTRING     :Subject
 4689:d=11 hl=2 l=  46 prim:            UTF8STRING        :ACME: ABxfL5s4bjvmyVRvl6y-Y_GhdzTdWpKqlmrKAIVe
 4737:d=11 hl=2 l=   1 prim:            INTEGER           :00
 4740:d=10 hl=2 l=  30 cons:           SEQUENCE          
 4742:d=11 hl=2 l=   2 prim:            VISIBLESTRING     :To
 4746:d=11 hl=2 l=  21 prim:            UTF8STRING        :[email protected]
 4769:d=11 hl=2 l=   1 prim:            INTEGER           :00
 4772:d=10 hl=2 l=  40 cons:           SEQUENCE          
 4774:d=11 hl=2 l=   4 prim:            VISIBLESTRING     :From
 4780:d=11 hl=2 l=  29 prim:            UTF8STRING        :[email protected]
 4811:d=11 hl=2 l=   1 prim:            INTEGER           :00

from acme4j.

augjoh avatar augjoh commented on June 8, 2024

Please see "Securing Header Fields with S/MIME" (RFC 7508) for more information.

from acme4j.

shred avatar shred commented on June 8, 2024

Thank you for the pointer! The tricky part is rather to use BouncyCastle for the S/MIME mail validation, and for the extraction of the protected headers from the signature. But I'm making progress there.

from acme4j.

shred avatar shred commented on June 8, 2024

It was tricky to find a correct way to verify secured mail headers, as many parts were not covered by BouncyCastle and had to be written by me. πŸ˜…

Now I have just pushed the changes. With EmailProcessor.signedMessage() you can use your S/MIME mail for the challenge. It checks the signing certificate against Java's cacert truststore, so the certificate must have been signed by a standard public CA.

For self-signed certificates, you can use EmailProcessor.builder().build(message), and use methods like trustStore() or certificate() before invoking build() to pass in your CA's certificate for verification.

What's still missing is a bunch of unit tests. That's the next thing I will take care of.

I appreciate your feedback. But I was able to make it work using your provided email and CA certificate, so I am quite confident it is working.

from acme4j.

augjoh avatar augjoh commented on June 8, 2024

These are fantastic news! I'm burning to test the latest version of acme4j. When do you plan to release a new version with these changes?

from acme4j.

shred avatar shred commented on June 8, 2024

I cannot find a way to generate S/MIME signed messages with secure headers enclosed in the signature via command line. Is it okay if I use your example email for unit tests?

from acme4j.

augjoh avatar augjoh commented on June 8, 2024

Sure, keep in mind that the used S/MIME certificate has a limited lifetime. βŒ›

from acme4j.

shred avatar shred commented on June 8, 2024

Thank you! Yes, it will only be temporary until I found a way to generate these kind of S/MIME mails. But I don't want to delay the next release because of that.

from acme4j.

shred avatar shred commented on June 8, 2024

I just released v2.16. It's available in the release section, and will be available on Maven Central in the next couple of hours.

This version should finally enable to read and validate RFC-7508 style protected headers. The unit tests are green with the email you provided here, so I'm confident. πŸ˜‰

I will close this issue, but feel free to reopen it if there are still related issues. Thank you for your help and your patience!

from acme4j.

augjoh avatar augjoh commented on June 8, 2024

@shred LGTM, I've run some tests with good cases and acme4j accepted all server sent messages so far! Thank you very much.

from acme4j.

shred avatar shred commented on June 8, 2024

That's good news! Thank you for your feedback.

from acme4j.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.