Subject: Re: [jose] Second compute JWE computation example

From: Mike Jones <[email-masked]>
Date: Fri, 6 Jul 2012 18:20:39 +0000

This is now in the spec.

				Thanks again,
				-- Mike

-----Original Message-----
From: Mike Jones 
Sent: Friday, June 29, 2012 10:48 AM
To: Richard L. Barnes
Cc: [email-masked]
Subject: RE: [jose] Second compute JWE computation example

Good catch.  I'll add to the JWA spec that RSA-OAEP specifies the use of OAEP padding with the default parameters defined by PKCS #1 v2.1 (RFC 3447) in Section A.2.1.

				-- Mike

-----Original Message-----
From: Richard L. Barnes [mailto:[email-masked]]
Sent: Friday, June 29, 2012 10:20 AM
To: Mike Jones
Cc: [email-masked]
Subject: Re: [jose] Second compute JWE computation example

This seems underspecified.  What parameters are you using for OAEP?  IIRC, it requires a digest algorithm and a masking generation function.  I don't see either of those specified in JWS or JWA.

On Jun 29, 2012, at 11:20 AM, Mike Jones wrote:

> Dear working group members,
>  
> A second complete JWE computation example is included below.  As I'd previously written, I'm adding example encryption computations to the JWE spec to aid implementers.  These values have been verified by two independent implementations.
>  
> This example uses the header values:
>     {"alg":"RSA-OAEP","enc":"A256GCM","iv":"48V1_ALb6US04U3b"}
>  
> This example verifies both the use of RSA-OAEP and the use of AES-GCM - including the use of the Additional Authenticated Data parameter and the Authentication Tag output.
>  
> Note that because the RSA-OAEP computation uses random values, the encrypted key computation will not be repeatable, although all resulting values will be decryptable to retrieve the original key value.
>  
> I'd be interested in hearing results from any of you who also try this JWE with your implementation.
>  
>                                                             Enjoy,
>                                                             -- Mike
>  
> CMK (CEK)
> [177, 161, 244, 128, 84, 143, 225, 115, 63, 180, 3, 255, 107, 154, 
> 212, 246, 138, 7, 110, 91, 112, 46, 34, 105, 47, 130, 203, 46, 122, 
> 234, 64, 252] IV [227, 197, 117, 252, 2, 219, 233, 68, 180, 225, 77, 
> 219] Plaintext [76, 105, 118, 101, 32, 108, 111, 110, 103, 32, 97, 
> 110, 100, 32, 112, 114, 111, 115, 112, 101, 114, 46] Header 
> {"alg":"RSA-OAEP","enc":"A256GCM","iv":"48V1_ALb6US04U3b"}
> Header Bytes
> [123, 34, 97, 108, 103, 34, 58, 34, 82, 83, 65, 45, 79, 65, 69, 80, 
> 34, 44, 34, 101, 110, 99, 34, 58, 34, 65, 50, 53, 54, 71, 67, 77, 34, 
> 44, 34, 105, 118, 34, 58, 34, 52, 56, 86, 49, 95, 65, 76, 98, 54, 85, 
> 83, 48, 52, 85, 51, 98, 34, 125] Encoded Header 
> eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00iLCJpdiI6IjQ4VjFfQUxiNlVTMD
> RVM2IifQ
> BEGIN RSA KEY PARAMETERS
> Exponent
> [1, 0, 1]
> Modulus
> [161, 168, 84, 34, 133, 176, 208, 173, 46, 176, 163, 110, 57, 30, 135, 
> 227, 9, 31, 226, 128, 84, 92, 116, 241, 70, 248, 27, 227, 193, 62, 5, 
> 91, 241, 145, 224, 205, 141, 176, 184, 133, 239, 43, 81, 103, 9, 161, 
> 153, 157, 179, 104, 123, 51, 189, 34, 152, 69, 97, 69, 78, 93, 140, 
> 131, 87, 182, 169, 101, 92, 142, 3, 22, 167, 8, 212, 56, 35, 79, 210, 
> 222, 192, 208, 252, 49, 109, 138, 173, 253, 210, 166, 201, 63, 102, 
> 74, 5, 158, 41, 90, 144, 108, 160, 79, 10, 89, 222, 231, 172, 31, 227, 
> 197, 0, 19, 72, 81, 138, 78, 136, 221, 121, 118, 196, 17, 146, 10, 
> 244, 188, 72, 113, 55, 221, 162, 217, 171, 27, 57, 233, 210, 101, 236, 
> 154, 199, 56, 138, 239, 101, 48, 198, 186, 202, 160, 76, 111, 234, 71, 
> 57, 183, 5, 211, 171, 136, 126, 64, 40, 75, 58, 89, 244, 254, 107, 84, 
> 103, 7, 236, 69, 163, 18, 180, 251, 58, 153, 46, 151, 174, 12, 103, 
> 197, 181, 161, 162, 55, 250, 235, 123, 110, 17, 11, 158, 24, 47, 133, 
> 8, 199, 235, 107, 126, 130, 246, 73, 195, 20, 108, 202, 176, 214, 187, 
> 45, 146, 182, 118, 54, 32, 200, 61, 201, 71, 243, 1, 255, 131, 84, 37, 
> 111, 211, 168, 228, 45, 192, 118, 27, 197, 235, 232, 36, 10, 230, 248, 
> 190, 82, 182, 140, 35, 204, 108, 190, 253, 186, 186, 27] D (private 
> key exponent) [144, 183, 109, 34, 62, 134, 108, 57, 44, 252, 10, 66, 
> 73, 54, 16, 181, 233, 92, 54, 219, 101, 42, 35, 178, 63, 51, 43, 92, 
> 119, 136, 251, 41, 53, 23, 191, 164, 164, 60, 88, 227, 229, 152, 228, 
> 213, 149, 228, 169, 237, 104, 71, 151, 75, 88, 252, 216, 77, 251, 231, 
> 28, 97, 88, 193, 215, 202, 248, 216, 121, 195, 211, 245, 250, 112, 71, 
> 243, 61, 129, 95, 39, 244, 122, 225, 217, 169, 211, 165, 48, 253, 220, 
> 59, 122, 219, 42, 86, 223, 32, 236, 39, 48, 103, 78, 122, 216, 187, 
> 88, 176, 89, 24, 1, 42, 177, 24, 99, 142, 170, 1, 146, 43, 3, 108, 64, 
> 194, 121, 182, 95, 187, 134, 71, 88, 96, 134, 74, 131, 167, 69, 106, 
> 143, 121, 27, 72, 44, 245, 95, 39, 194, 179, 175, 203, 122, 16, 112, 
> 183, 17, 200, 202, 31, 17, 138, 156, 184, 210, 157, 184, 154, 131, 
> 128, 110, 12, 85, 195, 122, 241, 79, 251, 229, 183, 117, 21, 123, 133, 
> 142, 220, 153, 9, 59, 57, 105, 81, 255, 138, 77, 82, 54, 62, 216, 38, 
> 249, 208, 17, 197, 49, 45, 19, 232, 157, 251, 131, 137, 175, 72, 126, 
> 43, 229, 69, 179, 117, 82, 157, 213, 83, 35, 57, 210, 197, 252, 171, 
> 143, 194, 11, 47, 163, 6, 253, 75, 252, 96, 11, 187, 84, 130, 210, 7, 
> 121, 78, 91, 79, 57, 251, 138, 132, 220, 60, 224, 173, 56, 224, 201] 
> The remaining RSA key parameters are included for completeness, but 
> should not be needed DP [100, 175, 152, 192, 78, 221, 137, 72, 116, 
> 169, 29, 109, 71, 188, 60, 88, 123, 104, 148, 60, 119, 49, 159, 206, 
> 78, 140, 34, 22, 248, 31, 121, 13, 210, 138, 183, 172, 94, 57, 189, 
> 129, 158, 74, 46, 19, 23, 190, 143, 174, 207, 226, 148, 37, 96, 241, 
> 75, 154, 69, 67, 243, 52, 122, 247, 104, 213, 210, 162, 69, 56, 213, 
> 195, 252, 120, 55, 42, 178, 92, 243, 57, 157, 66, 207, 145, 202, 84, 
> 243, 110, 235, 158, 150, 115, 0, 146, 169, 118, 21, 128, 130, 170, 
> 215, 24, 160, 4, 9, 1, 244, 94, 222, 45, 107, 57, 227, 157, 223, 243, 
> 86, 144, 38, 101, 154, 186, 209, 99, 204, 4, 199, 202, 114, 225] DQ 
> [14, 173, 32, 126, 2, 117, 13, 209, 70, 94, 34, 239, 64, 70, 103, 184, 
> 161, 13, 209, 69, 38, 176, 144, 113, 146, 60, 157, 115, 120, 248, 101, 
> 135, 65, 136, 196, 64, 203, 206, 177, 210, 241, 194, 143, 44, 28, 50, 
> 86, 24, 131, 140, 168, 11, 134, 25, 107, 216, 77, 85, 203, 35, 168, 
> 13, 197, 122, 34, 245, 246, 185, 60, 131, 164, 39, 219, 212, 237, 209, 
> 200, 252, 170, 172, 133, 167, 63, 111, 52, 48, 84, 124, 32, 34, 37, 
> 87, 132, 72, 232, 201, 13, 147, 216, 29, 209, 216, 242, 253, 91, 250, 
> 143, 153, 217, 126, 109, 188, 188, 126, 76, 39, 164, 127, 186, 49, 
> 201, 226, 131, 82, 162, 150, 142, 43] InverseQ [84, 131, 41, 49, 134, 
> 207, 127, 142, 221, 79, 92, 63, 204, 53, 23, 124, 248, 166, 177, 39, 
> 160, 156, 195, 128, 215, 52, 218, 95, 182, 134, 147, 255, 46, 173, 
> 142, 145, 243, 230, 86, 212, 92, 84, 236, 9, 86, 3, 34, 214, 201, 186, 
> 170, 234, 221, 122, 84, 87, 123, 133, 7, 116, 203, 167, 229, 80, 174, 
> 18, 148, 236, 157, 7, 173, 96, 193, 169, 206, 177, 113, 142, 0, 235, 
> 252, 217, 193, 234, 208, 77, 222, 47, 129, 235, 181, 153, 20, 184, 
> 171, 231, 62, 179, 39, 177, 69, 5, 149, 245, 29, 201, 181, 115, 199, 
> 40, 243, 244, 145, 127, 95, 38, 152, 215, 134, 171, 116, 180, 163, 
> 127, 130, 255, 20, 214] P [214, 190, 118, 94, 78, 58, 115, 226, 236, 
> 124, 30, 79, 227, 141, 169, 237, 171, 93, 61, 74, 241, 65, 44, 184, 
> 154, 216, 191, 181, 146, 55, 50, 7, 246, 18, 225, 85, 109, 74, 3, 6, 
> 246, 145, 67, 228, 150, 198, 70, 228, 154, 129, 51, 47, 178, 87, 174, 
> 132, 129, 141, 42, 202, 221, 130, 16, 129, 135, 76, 131, 32, 4, 61, 
> 51, 227, 94, 255, 225, 35, 111, 245, 121, 52, 143, 85, 151, 243, 47, 
> 73, 95, 124, 217, 244, 220, 133, 234, 88, 94, 76, 12, 91, 168, 81, 
> 129, 52, 135, 54, 246, 190, 26, 229, 55, 250, 202, 173, 183, 195, 35, 
> 5, 27, 78, 184, 227, 130, 39, 145, 111, 0, 186, 10, 93] Q [192, 182, 
> 247, 231, 30, 225, 153, 5, 153, 177, 98, 102, 7, 251, 229, 123, 206, 
> 226, 134, 6, 117, 245, 47, 37, 4, 68, 78, 44, 139, 25, 27, 134, 178, 
> 101, 87, 189, 30, 47, 96, 13, 80, 142, 6, 101, 3, 117, 160, 216, 85, 
> 52, 141, 199, 255, 5, 203, 13, 88, 97, 175, 87, 26, 177, 167, 13, 236, 
> 52, 208, 157, 188, 113, 21, 40, 120, 16, 127, 140, 162, 53, 162, 102, 
> 180, 58, 187, 245, 79, 214, 151, 33, 108, 74, 193, 222, 32, 191, 17, 
> 72, 152, 229, 171, 221, 4, 75, 244, 161, 1, 71, 57, 54, 69, 171, 84, 
> 6, 121, 131, 100, 148, 200, 1, 252, 19, 179, 72, 58, 241, 70, 71, 190, 
> 215] END RSA KEY PARAMETERS Encrypted Key [142, 252, 40, 202, 21, 177, 
> 56, 198, 232, 7, 151, 49, 95, 169, 220, 2, 46, 214, 167, 116, 57, 20, 
> 164, 109, 150, 98, 49, 223, 154, 95, 71, 209, 233, 17, 174, 142, 203, 
> 232, 132, 167, 17, 42, 51, 125, 22, 221, 135, 17, 67, 197, 148, 246, 
> 139, 145, 160, 238, 99, 119, 171, 95, 117, 202, 87, 251, 101, 254, 58, 
> 215, 135, 195, 135, 103, 49, 119, 76, 46, 49, 198, 27, 31, 58, 44, 
> 192, 222, 21, 16, 13, 216, 161, 179, 236, 65, 143, 38, 43, 218, 195, 
> 76, 140, 243, 71, 243, 79, 124, 216, 208, 242, 171, 34, 245, 57, 154, 
> 93, 76, 230, 204, 234, 82, 117, 248, 39, 13, 62, 60, 215, 8, 51, 248, 
> 254, 47, 150, 36, 46, 27, 247, 98, 77, 56, 92, 44, 19, 39, 12, 77, 54, 
> 101, 194, 126, 86, 0, 64, 239, 95, 211, 64, 26, 219, 93, 211, 36, 154, 
> 250, 117, 177, 213, 232, 142, 184, 216, 92, 20, 248, 69, 175, 180, 71, 
> 205, 221, 235, 224, 95, 113, 5, 33, 86, 18, 157, 61, 199, 8, 121, 0, 
> 0, 135, 65, 67, 220, 164, 15, 230, 155, 71, 53, 64, 253, 209, 169, 
> 255, 34, 64, 101, 7, 43, 102, 227, 83, 171, 52, 225, 119, 253, 182, 
> 96, 195, 225, 34, 156, 211, 202, 7, 194, 255, 137, 59, 170, 172, 72, 
> 234, 222, 203, 123, 249, 121, 254, 143, 173, 105, 65, 187, 189, 163, 
> 64, 151, 145, 99, 17] Encoded Encrypted Key 
> jvwoyhWxOMboB5cxX6ncAi7Wp3Q5FKRtlmIx35pfR9HpEa6Oy-iEpxEqM30W3YcRQ8WU9o
> uRoO5jd6tfdcpX-2X-OteHw4dnMXdMLjHGGx86LMDeFRAN2KGz7EGPJivaw0yM80fzT3zY
> 0PKrIvU5ml1M5szqUnX4Jw0-PNcIM_j-L5YkLhv3Yk04XCwTJwxNNmXCflYAQO9f00Aa21
> 3TJJr6dbHV6I642FwU-EWvtEfN3evgX3EFIVYSnT3HCHkAAIdBQ9ykD-abRzVA_dGp_yJA
> ZQcrZuNTqzThd_22YMPhIpzTygfC_4k7qqxI6t7Le_l5_o-taUG7vaNAl5FjEQ
> Additional Authenticated Data
> eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00iLCJpdiI6IjQ4VjFfQUxiNlVTMD
> RVM2IifQ.jvwoyhWxOMboB5cxX6ncAi7Wp3Q5FKRtlmIx35pfR9HpEa6Oy-iEpxEqM30W3
> YcRQ8WU9ouRoO5jd6tfdcpX-2X-OteHw4dnMXdMLjHGGx86LMDeFRAN2KGz7EGPJivaw0y
> M80fzT3zY0PKrIvU5ml1M5szqUnX4Jw0-PNcIM_j-L5YkLhv3Yk04XCwTJwxNNmXCflYAQ
> O9f00Aa213TJJr6dbHV6I642FwU-EWvtEfN3evgX3EFIVYSnT3HCHkAAIdBQ9ykD-abRzV
> A_dGp_yJAZQcrZuNTqzThd_22YMPhIpzTygfC_4k7qqxI6t7Le_l5_o-taUG7vaNAl5FjE
> Q
> Additional Authenticated Data Bytes
> [101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 83, 85, 48, 69, 116, 
> 84, 48, 70, 70, 85, 67, 73, 115, 73, 109, 86, 117, 89, 121, 73, 54, 
> 73, 107, 69, 121, 78, 84, 90, 72, 81, 48, 48, 105, 76, 67, 74, 112, 
> 100, 105, 73, 54, 73, 106, 81, 52, 86, 106, 70, 102, 81, 85, 120, 105, 
> 78, 108, 86, 84, 77, 68, 82, 86, 77, 50, 73, 105, 102, 81, 46, 106, 
> 118, 119, 111, 121, 104, 87, 120, 79, 77, 98, 111, 66, 53, 99, 120, 
> 88, 54, 110, 99, 65, 105, 55, 87, 112, 51, 81, 53, 70, 75, 82, 116, 
> 108, 109, 73, 120, 51, 53, 112, 102, 82, 57, 72, 112, 69, 97, 54, 79, 
> 121, 45, 105, 69, 112, 120, 69, 113, 77, 51, 48, 87, 51, 89, 99, 82, 
> 81, 56, 87, 85, 57, 111, 117, 82, 111, 79, 53, 106, 100, 54, 116, 102, 
> 100, 99, 112, 88, 45, 50, 88, 45, 79, 116, 101, 72, 119, 52, 100, 110, 
> 77, 88, 100, 77, 76, 106, 72, 71, 71, 120, 56, 54, 76, 77, 68, 101, 
> 70, 82, 65, 78, 50, 75, 71, 122, 55, 69, 71, 80, 74, 105, 118, 97, 
> 119, 48, 121, 77, 56, 48, 102, 122, 84, 51, 122, 89, 48, 80, 75, 114, 
> 73, 118, 85, 53, 109, 108, 49, 77, 53, 115, 122, 113, 85, 110, 88, 52, 
> 74, 119, 48, 45, 80, 78, 99, 73, 77, 95, 106, 45, 76, 53, 89, 107, 76, 
> 104, 118, 51, 89, 107, 48, 52, 88, 67, 119, 84, 74, 119, 120, 78, 78, 
> 109, 88, 67, 102, 108, 89, 65, 81, 79, 57, 102, 48, 48, 65, 97, 50, 
> 49, 51, 84, 74, 74, 114, 54, 100, 98, 72, 86, 54, 73, 54, 52, 50, 70, 
> 119, 85, 45, 69, 87, 118, 116, 69, 102, 78, 51, 101, 118, 103, 88, 51, 
> 69, 70, 73, 86, 89, 83, 110, 84, 51, 72, 67, 72, 107, 65, 65, 73, 100, 
> 66, 81, 57, 121, 107, 68, 45, 97, 98, 82, 122, 86, 65, 95, 100, 71, 
> 112, 95, 121, 74, 65, 90, 81, 99, 114, 90, 117, 78, 84, 113, 122, 84, 
> 104, 100, 95, 50, 50, 89, 77, 80, 104, 73, 112, 122, 84, 121, 103, 
> 102, 67, 95, 52, 107, 55, 113, 113, 120, 73, 54, 116, 55, 76, 101, 95, 
> 108, 53, 95, 111, 45, 116, 97, 85, 71, 55, 118, 97, 78, 65, 108, 53, 
> 70, 106, 69, 81] Ciphertext [253, 237, 181, 180, 97, 161, 105, 207, 
> 233, 120, 65, 100, 45, 122, 246, 116, 195, 212, 102, 37, 36, 175] 
> Encoded Ciphertext _e21tGGhac_peEFkLXr2dMPUZiUkrw Authentication Tag 
> (Integrity Value) [97, 182, 82, 120, 112, 141, 13, 144, 106, 1, 220, 
> 233, 68, 233, 114, 139] Encoded Authentication Tag (Encoded Integrity
> Value) YbZSeHCNDZBqAdzpROlyiw JWE
> eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00iLCJpdiI6IjQ4VjFfQUxiNlVTMD
> RVM2IifQ.jvwoyhWxOMboB5cxX6ncAi7Wp3Q5FKRtlmIx35pfR9HpEa6Oy-iEpxEqM30W3
> YcRQ8WU9ouRoO5jd6tfdcpX-2X-OteHw4dnMXdMLjHGGx86LMDeFRAN2KGz7EGPJivaw0y
> M80fzT3zY0PKrIvU5ml1M5szqUnX4Jw0-PNcIM_j-L5YkLhv3Yk04XCwTJwxNNmXCflYAQ
> O9f00Aa213TJJr6dbHV6I642FwU-EWvtEfN3evgX3EFIVYSnT3HCHkAAIdBQ9ykD-abRzV
> A_dGp_yJAZQcrZuNTqzThd_22YMPhIpzTygfC_4k7qqxI6t7Le_l5_o-taUG7vaNAl5FjE
> Q._e21tGGhac_peEFkLXr2dMPUZiUkrw.YbZSeHCNDZBqAdzpROlyiw
>  
> <JWE2.log>_______________________________________________
> jose mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/jose