Last active
July 17, 2018 23:21
-
-
Save ravenet/46feeace86d683df90f3956aba96fe21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String key = "-----BEGIN RSA PRIVATE KEY-----\n" | |
+"MIIEpAIBAAKCAQEA7c7nRCofBrrKqlzmVakQropoOd2ypgJJS6ISKUDBKeLNGVKN\n" | |
+"RnBNKMxhR6lrf52xV3BH613HuFGluAvGAUAMOsRAyq7nguUqniCwG1kljs19dqwP\n" | |
+"3cjXhdCNL9kE5bzh1U56PlXZRC8yp/moIHO1MZsfs1qhnmJUg1GfbTEn+DrJ3qi0\n" | |
+"ozaQjA8ypKPaLlVPNSFaMEef40n+9VxLb6qNTUrJz/9MSig/ackwetWze2sCtJGJ\n" | |
+"ZUHepsiViYhMWjaskKGkuCVWn7+99x7A7wt3MGjJxF1DTTRIGJ2WvD+eEd1WKiYl\n" | |
+"9wEKKMEHo1Za/op01hL+BIC2PKcPXAG1qE6YdQIDAQABAoIBADW8cCPGBNbHdK5E\n" | |
+"acPnfR6DpgOVZh3/HELb75Ck0kE9v6y+K7BEBht2+3BvBxyCLKWeeJHl0hCDWpgZ\n" | |
+"CPgVWe4ZlK54EVZRpGyw5Dp5zXPUWUpsnPU3wgO52X17Y5DqOnmxzwuw6HRw2dh9\n" | |
+"IJGcs8/uxp4Hl8erXn+B/S12UxrS9mBiSgE1zsGqoXDTVLTX7ZC+CM8HEAVl+2N5\n" | |
+"n17ovUsYHOMGoZK+o3cP3rwMO01pYPUkj77pMP5IYn5hfOTf4TzcaYidpVvu8zfC\n" | |
+"OKwp56TubFzx5jkyyE8JW9kpjUxfE4Qhhy4drVITvBTt/fndbmw2qSxmaolo8sav\n" | |
+"mkTbbM0CgYEA/62T6lV51YeXcRTsodqsCvuOxicSuGcUryKpFbgYzHV7xUhwO6iI\n" | |
+"4UbOodVGO2/JupzqBFI7SolfTtnN3iD3NAFw3JXJ9BEaiRNpszthEFxrTuBRfM+l\n" | |
+"VX7hrsf/i/d4X6SyzFK5G6fhWseRfA0iJdmdBmGVXInNmnRR8J7yQS8CgYEA7huQ\n" | |
+"oEVWzugGO1+cS5k6wyZxaaXPU4UGQsfps1BL0yKi2axWD2FUTgw9ppcgZTEUJVqu\n" | |
+"/Vj8hPI46VvwhCMSqWG3DwbeLV9/ueqUbQgi2/vEEMc1BMpUMsobsbL8WbTPjiPd\n" | |
+"rQE3mvpY1ecxvqLvicAGVwGs4IVyKjcUCKeOr5sCgYEA9dfJaoFV7OO70pf0EI1a\n" | |
+"8BSCbDYV4gn78Yq6Wo/yCGbO5BuLD1I2i6ax+RpBtdT/e9h1jEIlkL4WTpNPSE8a\n" | |
+"Y38fLns4/N2VTkjEUfq+kiTLacR3ljNzHooqJw1XwxXpQM30vlKsetMp9Uf/s/BM\n" | |
+"7WgZfJFINPqsH9/JCj1LYzECgYAxm4CYQ5oAZYrW1+aiQXxiqCG81xTI29AgHbJs\n" | |
+"72+8v1yaaTNM5QRBdn9ps9bF/mGqHqiSk/WYZTbCN6t2fDApJfiTouSrI1hjDaJ6\n" | |
+"zNUma9+/dyFurBC6vCzk6tt0fR05CfPnVXeWTE4x0ockpqGtW1p2yhyQcn0EmpEL\n" | |
+"9IzfvQKBgQCdKyRz88HI42BE1usMFPFk6IEoqTbWSdru+bgxFb2sRAGQQ1uCrvOP\n" | |
+"gqoMCeiOX5KKRaXY2RaCYTNbwMnTuJqQdKpLVPCWUASIUcCCtkgA6tw4g/+eJxOr\n" | |
+"qF48ZOhFiPDBwW+v/n5UjkDw31K6OA0/QxJoTkK66AItoec4J0Qo2w==\n" | |
+"-----END RSA PRIVATE KEY-----\n"; | |
my code | |
// it is JWS with added JWE in second segement. | |
string encryptedInfo = "eyJhbGciOiJSUzI1NiIsIml2IjoiIiwidGFnIjoiIiwiZW5jIjoiIiwidHlwIjoiSk9TRSIsImtpZCI6IiIsImNoYW5uZWxTZWN1cml0eU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c06JwbyYs5T6erYUA5u0iBZ2dzKM79i0A"; | |
string[] stringArray = encryptedInfo.Split(new[] { '.' }); | |
byte[] decode64UrlBase = EncodingHelper.ToByteArray(stringArray[1]); | |
string base64String = Encoding.UTF8.GetString(decode64UrlBase); | |
JweAlgorithm algorithm = JweAlgorithm.RSA1_5; | |
JweEncryption encryption = JweEncryption.A128GCM; | |
Jose.JWT.Decode(base64String , keyHolderInfo.PrivateKey, algorithm, encryption) | |
// Java Code(working) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment