Does "RSA/ECB/OAEPWithSHA-1AndMGF1Padding" mean that SHA-256 must be used for 
padding too?

I did not read it so.

Did somebody manage to use JCA correctly with one algorithm specifier like 
RSA/ECB/OAEPWithSHA-1AndMGF1PaddingWithSHA-256?



Axel

A.2.<http://tools.ietf.org/id/draft-ietf-jose-json-web-algorithms-26.html#rfc.appendix.A.2>
 Key Management Algorithm Identifier 
Cross-Reference<http://tools.ietf.org/id/draft-ietf-jose-json-web-algorithms-26.html#EncAlgXref>

This section contains a table cross-referencing the JWE alg (algorithm) values 
defined in this specification with the equivalent identifiers used by other 
standards and software packages.
JWE

XML ENC

JCA

OID

RSA1_5

http://www.w3.org/2001/04/xmlenc#rsa-1_5

RSA/ECB/PKCS1Padding

1.2.840.113549.1.1.1

RSA-OAEP

http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p

RSA/ECB/OAEPWithSHA-1AndMGF1Padding

1.2.840.113549.1.1.7

RSA-OAEP-256

http://www.w3.org/2009/xmlenc11#rsa-oaep

RSA/ECB/OAEPWithSHA-256AndMGF1Padding

1.2.840.113549.1.1.7






-----Original Message-----
From: Antonio Sanso [mailto:[email protected]]
Sent: Wednesday, May 07, 2014 4:24 PM
To: Richer, Justin P.
Cc: Brian Campbell; Matt Miller; [email protected]; Nennker, Axel
Subject: ***CAUTION_Invalid_Signature*** Re: [jose] RSA-OAEP-256 Example



On 5/7/14, 2:21 AM, 
[email protected]<mailto:[email protected]<mailto:[email protected]%3cmailto:[email protected]>>
 wrote:

> I think that the java implementations implemented the spec and

> everything is ok from that POV.

>

> These implementations are not broken.



The JOSE Java implementations did not implement the spec, though.

draft-ietf-jose-json-web-algorithms ยง 4.3 clearly states the hash and mask 
generation functions are to use the same algorithm -- SHA-1 (and

MGF1 with SHA-1) in the case of "RSA-OAEP", and SHA-256 (and MGF1 with

SHA-256) in the case of "RSA-OAEP-256".



>

>

>

> One could argue that when we replace SHA-1 by SHA-256 in one place

> then we might consider to replace it in the padding too.



That is exactly what draft-ietf-jose-json-web-algorithms specified.



>

> My feeling is that using sha-256 for the padding does not give us more

> security. YMMW

>



That is a separate debate, I think.  The prevailing opinion (at least around 
the IETF) is "don't mix the algorithms".





--

- m&m



Matt Miller < 
[email protected]<mailto:[email protected]<mailto:[email protected]%3cmailto:[email protected]>>
 > Cisco Systems, Inc.



>

>

>

>

> *From:*jose

> [mailto:[email protected]<mailto:[email protected]><mailto:[email protected]%3cmailto:[email protected]%3e>]
>  *On

> Behalf Of *Brian Campbell *Sent:* Wednesday, May 07, 2014 6:54 AM

> *To:* Matt Miller

> *Cc:* Antonio Sanso; 
> [email protected]<mailto:[email protected]<mailto:[email protected]%3cmailto:[email protected]>>
>  *Subject:*

> Re: [jose]

> RSA-OAEP-256 Example

>

>

>

> Thanks Matt.

>

> That is why I was looking for someone to verify using a different

> platform. Though I was hoping it'd just work.

>

> Matt, can you try decrypting this one by chance? Using the same key. I

> was more explicit with the parameters and, I think, MGF1 should be

> using SHA-256 now too.

>

>

> eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0.fL5IL5cMCj

> jU9G9_ZjsD2XO0HIwTOwbVwulcZVw31_rx2qTcHzbYhIvrvbcVLTfJzn8xbQ3UEL442ZgZ

> 1PcFYKENYePXiEyvYxPN8dmvj_OfLSJDEqR6kvwOb6nghGtxfzdB_VRvFt2eehbCA3gWpi

> OYHHvSTFdBPGx2KZHQisLz3oZR8EWiZ1woEpHy8a7FoQ2zzuDlZEJQOUrh09b_EJxmcE2j

> L6wmEtgabyxy3VgWg3GqSPUISlJZV9HThuVJezzktJdpntRDnAPUqjc8IwByGpMleIQcPu

> BUseRRPr_OsroOJ6eTl5DuFCmBOKb-eNNw5v-GEcVYr1w7X9oXoA.0frdIwx8P8UAzh1s9

> _PgOA.RAzILH0xfs0yxzML1CzzGExCfE2_wzWKs0FVuXfM8R5H68yTqTbqIqRCp2feAH5G

> Svluzmztk2_CkGNSjAyoaw.4nMUXOgmgWvM-08tIZ-h5w

>

>

>

>

> On Tue, May 6, 2014 at 8:39 PM, Matt Miller

> <[email protected]<mailto:[email protected]<mailto:[email protected]%3cmailto:[email protected]>>

> <mailto:[email protected]<mailto:[email protected]<mailto:[email protected]%3cmailto:[email protected]>>>>
>  wrote:

>

> Short answer: You are all equally broken -- except from a certain

> point of view d-:

>

> Long answer: The code I have is based on OpenSSL, which is hard-coded

> to use SHA1 for the hash and mask generation (boo!), which means one

> has to implement OAEP-SHA256 from scratch (hiss!!).

>

> When I implemented it per RFC 3447 and

> draft-ietf-jose-json-web-algorithms-26#section-4.3, I could not

> decrypt the provided results.  When I hard-coded MGF1 to use "SHA1", I

> could decrypt provided results.  A search through BouncyCastle's code

> shows that "RSA/ECB/OAEPWithSHA-256AndMGF1Padding" uses a Hash

> function of

> SHA-256 generate the lHash but its MGF1 uses a "SHA-1". Further

> evidence is shown with how [FORGE] can be made to work with Java

> (search their homepage for "Compatible with Java's

> RSA/ECB/OAEPWithSHA-256AndMGF1Padding").

>

> Reconciling all of this with

> draft-ietf-jose-json-web-algorithms#appendix-A.2 does not look to be

> very straight-forward.  It appears that the JCA identifier is meant to

> be "MGF1 with SHA1"; that ought to be explicitly noted.

> The XMLENC reference is arguably incomplete, since

> "http://www.w3.org/2009/xmlenc11#rsa-oaep"; defaults to

> "http://www.w3.org/2009/xmlenc11#mgf1sha1"; (MGF1 with SHA1); this can

> probably be addressed by explicitly stating the mask generation

> function is "http://www.w3.org/2009/xmlenc11#mgf1sha256";

> (MGF1 with SHA-256).

>

>

>

>

>
_______________________________________________
jose mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/jose

Reply via email to