mail encryption with ecdsa cert

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

mail encryption with ecdsa cert

clou
openssl 1.1.0.f
ecdsa 512 certificate

openssl cms -sign works perfect and sending an email.

For encryption and sending an email I just get an email with an attachment smime.p7m.

I use the following encryption command

openssl cms -encrypt \
        -recip cert.pem \
        -subject 'openssl encrypt' \
        -to email \
        -from email \
        -in msg.txt \
        -keyopt ecdh_kdf_md:sha256 \
        | \
        sendmail email


Any idea how I need do encrypt (or encrypt and sign) in order to get a proper email?

Thanks a lot!

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: mail encryption with ecdsa cert

Kyle Hamilton
On the algorithmic side of things, the ECDSA algorithm cannot encrypt.
It is signing-only.

In order to use Elliptical Curves to encrypt, you would have to use
the "Elliptical Curve Diffie-Hellman" algorithm to perform a key
agreement.  This requires that both the sender and the recipient have
EC keys which are marked in their certificates as being for the
purpose "keyAgreement".

Your command line only specifies the recipient certificate, not the
sending certificate.  You can't do an ecdh_kdf_md:sha256 operation
without the sender's certificate and private key.

I hope this helps!

-Kyle H



On Fri, Jan 26, 2018 at 7:13 AM, clou <[hidden email]> wrote:

> openssl 1.1.0.f
> ecdsa 512 certificate
>
> openssl cms -sign works perfect and sending an email.
>
> For encryption and sending an email I just get an email with an attachment
> smime.p7m.
>
> I use the following encryption command
>
> openssl cms -encrypt \
>         -recip cert.pem \
>         -subject 'openssl encrypt' \
>         -to email \
>         -from email \
>         -in msg.txt \
>         -keyopt ecdh_kdf_md:sha256 \
>         | \
>         sendmail email
>
>
> Any idea how I need do encrypt (or encrypt and sign) in order to get a
> proper email?
>
> Thanks a lot!
>
> --
> openssl-users mailing list
> To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
>
--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: mail encryption with ecdsa cert

Jakob Bohm-7
Doesn't S/MIME permit the half-ephemeral ECDH algorithm where the
recipient's static ECDH certificate is combined with a per message
ephemeral ECDH key?

On 26/01/2018 18:20, Kyle Hamilton wrote:

> On the algorithmic side of things, the ECDSA algorithm cannot encrypt.
> It is signing-only.
>
> In order to use Elliptical Curves to encrypt, you would have to use
> the "Elliptical Curve Diffie-Hellman" algorithm to perform a key
> agreement.  This requires that both the sender and the recipient have
> EC keys which are marked in their certificates as being for the
> purpose "keyAgreement".
>
> Your command line only specifies the recipient certificate, not the
> sending certificate.  You can't do an ecdh_kdf_md:sha256 operation
> without the sender's certificate and private key.
>
> I hope this helps!
>
> -Kyle H
>
>
>
> On Fri, Jan 26, 2018 at 7:13 AM, clou <[hidden email]> wrote:
>> openssl 1.1.0.f
>> ecdsa 512 certificate
>>
>> openssl cms -sign works perfect and sending an email.
>>
>> For encryption and sending an email I just get an email with an attachment
>> smime.p7m.
>>
>> I use the following encryption command
>>
>> openssl cms -encrypt \
>>          -recip cert.pem \
>>          -subject 'openssl encrypt' \
>>          -to email \
>>          -from email \
>>          -in msg.txt \
>>          -keyopt ecdh_kdf_md:sha256 \
>>          | \
>>          sendmail email
>>
>>
>> Any idea how I need do encrypt (or encrypt and sign) in order to get a
>> proper email?
>>
>> Thanks a lot!
>>
>> --
>> openssl-users mailing list
>> To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
>>

Enjoy

Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: mail encryption with ecdsa cert

Viktor Dukhovni
In reply to this post by clou


> On Jan 26, 2018, at 10:13 AM, clou <[hidden email]> wrote:
>
> openssl cms -sign works perfect and sending an email.
>
> For encryption and sending an email I just get an email with an attachment smime.p7m.
>
> I use the following encryption command
>
> openssl cms -encrypt \
>         -recip cert.pem \
>         -subject 'openssl encrypt' \
>         -to email \
>         -from email \
>         -in msg.txt \
>         -keyopt ecdh_kdf_md:sha256 \
>         | \
>         sendmail email
>
>
> Any idea how I need do encrypt (or encrypt and sign) in order to get a proper email?

This requires a pipeline of two cms(1) commands, one to sign and other
to encrypt (S/MIME is generally a sign-then-encrypt encapsulation).
The inner signed content would be the just the payload no mail headers.

And yes, ECDSA is supported with CMS.

--
        Viktor.

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: mail encryption with ecdsa cert

clou
On 26 Jan 2018, at 18:55, Viktor Dukhovni <[hidden email]> wrote:

This requires a pipeline of two cms(1) commands, one to sign and other
to encrypt (S/MIME is generally a sign-then-encrypt encapsulation).
The inner signed content would be the just the payload no mail headers.

openssl cms -sign \
        -in msg.txt \
        -inkey key.pem \
        -signer pub.pem \
        -text \
        | \
openssl cms -encrypt \
        -recip pub.pem \
        -subject 'openssl signed and encrypt' \
        -to email \
        -from email \
        | \
        sendmail email

With this I still get the same result, an smime.p7m attachment which can not be opened.

Please note, using the same certificate/key in OSX mail app for sign and encrypt works perfect.

Any help is very much appreciate as I already spent 3 evening with reading/&fiddling around with the different parameters :-)

Thanks so much!

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: mail encryption with ecdsa cert

clou
In reply to this post by Kyle Hamilton


On 26 Jan 2018, at 18:20, Kyle Hamilton <[hidden email]> wrote:

In order to use Elliptical Curves to encrypt, you would have to use
the "Elliptical Curve Diffie-Hellman" algorithm to perform a key
agreement.  This requires that both the sender and the recipient have
EC keys which are marked in their certificates as being for the
purpose "keyAgreement”.

I have made sure that keyAgreement is in.
I get the following error

Error:
PKCS7_RECIP_INFO_set:encryption not supported for this key type

Key gen happens like this
/usr/local/bin/openssl ecparam -name secp521r1 -out secp521r1.pem
/usr/local/bin/openssl req -x509 -nodes -days 3650 -newkey ec:secp521r1.pem -keyout email-key.pem -out email.ch.pem

Which type of key do I need to generate? (for email signing and encryption).

Thanks a lot for any help !

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users