久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<tfoot id='0GKd6'></tfoot>
      • <bdo id='0GKd6'></bdo><ul id='0GKd6'></ul>
      <legend id='0GKd6'><style id='0GKd6'><dir id='0GKd6'><q id='0GKd6'></q></dir></style></legend>
      <i id='0GKd6'><tr id='0GKd6'><dt id='0GKd6'><q id='0GKd6'><span id='0GKd6'><b id='0GKd6'><form id='0GKd6'><ins id='0GKd6'></ins><ul id='0GKd6'></ul><sub id='0GKd6'></sub></form><legend id='0GKd6'></legend><bdo id='0GKd6'><pre id='0GKd6'><center id='0GKd6'></center></pre></bdo></b><th id='0GKd6'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='0GKd6'><tfoot id='0GKd6'></tfoot><dl id='0GKd6'><fieldset id='0GKd6'></fieldset></dl></div>
    1. <small id='0GKd6'></small><noframes id='0GKd6'>

        如何使用我自己的 rsa 私鑰使用 rs256 算法對字節

        how to sign bytes using my own rsa private key using rs256 algorithm?(如何使用我自己的 rsa 私鑰使用 rs256 算法對字節進行簽名?)

      1. <legend id='V9JtZ'><style id='V9JtZ'><dir id='V9JtZ'><q id='V9JtZ'></q></dir></style></legend>
            <bdo id='V9JtZ'></bdo><ul id='V9JtZ'></ul>
            1. <small id='V9JtZ'></small><noframes id='V9JtZ'>

                <tbody id='V9JtZ'></tbody>

                <i id='V9JtZ'><tr id='V9JtZ'><dt id='V9JtZ'><q id='V9JtZ'><span id='V9JtZ'><b id='V9JtZ'><form id='V9JtZ'><ins id='V9JtZ'></ins><ul id='V9JtZ'></ul><sub id='V9JtZ'></sub></form><legend id='V9JtZ'></legend><bdo id='V9JtZ'><pre id='V9JtZ'><center id='V9JtZ'></center></pre></bdo></b><th id='V9JtZ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='V9JtZ'><tfoot id='V9JtZ'></tfoot><dl id='V9JtZ'><fieldset id='V9JtZ'></fieldset></dl></div>
                <tfoot id='V9JtZ'></tfoot>
                  本文介紹了如何使用我自己的 rsa 私鑰使用 rs256 算法對字節進行簽名?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我有自己的私鑰字符串,即

                  I have my own private key string, i.e.

                  -----BEGIN RSA PRIVATE KEY-----
                  
                  MIICXAIBAAKBgQCSAYYgzvGTww....
                  ....
                  ....
                  .....
                  3yUMYj9oYzqdrRHP0XgD0cEEvyqPBwLaNsRdFwy5qTiHjj0f+ZWHQWmqcoLmmpzyZEbIvQm/VhbjRF6iKG4WZ9Hfa7ntYRNGdWgD/KMIeZI=
                  
                  -----END RSA PRIVATE KEY-----
                  

                  現在,我需要在 C# 中使用此私鑰簽署我的聲明集以生成 JWT 有效負載.

                  Now, I need to sign my claim set using this private key in C# to generate JWT payload.

                  我寫了以下代碼:

                  var utc0 = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
                  var issueTime = DateTime.Now;
                  
                  var iat = (int)issueTime.Subtract(utc0).TotalSeconds;
                  var exp = (int)issueTime.AddMinutes(55).Subtract(utc0).TotalSeconds;
                  
                  var payload = new
                  {
                      iss = email,
                      prn = prn,
                      scope = "scope",
                      aud = "https://example.com",
                      exp = exp,
                      iat = iat
                  };
                  
                  var segments = new List<string>();
                  var header = new { typ = "JWT", alg = "RS256" };
                  
                  byte[] headerBytes = Encoding.UTF8.GetBytes(jsonSerializer.Serialize(header));
                  byte[] payloadBytes = Encoding.UTF8.GetBytes(jsonSerializer.Serialize(payload));
                  
                  segments.Add(Base64UrlEncode(headerBytes));
                  segments.Add(Base64UrlEncode(payloadBytes));
                  
                  var stringToSign = string.Join(".", segments.ToArray());
                  
                  var bytesToSign = Encoding.UTF8.GetBytes(stringToSign);
                  

                  現在我需要這些 bytesToSign 由我的私鑰簽名,正如我上面提到的使用 rs256 算法.任何人都可以幫忙嗎?

                  Now I need these bytesToSign to be signed by my private key as I mentioned above using the rs256 alogorithm. Can anyone help?

                  我已按照以下內容更新了我的代碼:

                  I've updated my code as per the following:

                  var pemprivatekey = OpenSSLKey.DecodeOpenSSLPrivateKey(privateKey);
                  RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider();
                  
                  if (pemprivatekey != null)
                  {
                      rsaProvider = OpenSSLKey.DecodeRSAPrivateKey(pemprivatekey);
                  }
                  
                  byte[] signature = rsaProvider.SignData(bytesToSign, "SHA256");
                  
                  segments.Add(Base64UrlEncode(signature));
                  
                  return string.Join(".", segments.ToArray());
                  

                  并生成 JWT 令牌.請讓我知道我在哪里犯了錯誤,因為它不正確:當我將它傳遞給 API 時,它不起作用并引發錯誤.

                  and generated JWT token. Please let me know where I made a mistake as its not correct one: when I pass it to the API, it doesn't work and throws an error.

                  推薦答案

                  我找到了一些純粹基于 Javascript 的解決方案,如果它對任何人有用的話.您可以在這里找到 JS 庫.

                  I found some purely Javascript based solution, if it is useful to anyone. You can find the JS Libraries here.

                  它解決了我的要求.

                  這篇關于如何使用我自己的 rsa 私鑰使用 rs256 算法對字節進行簽名?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  What are good algorithms for vehicle license plate detection?(車牌檢測有哪些好的算法?)
                  onClick event for Image in Unity(Unity中圖像的onClick事件)
                  Running Total C#(運行總 C#)
                  Deleting a directory when clicked on a hyperlink with JAvascript.ASP.NET C#(單擊帶有 JAvascript.ASP.NET C# 的超鏈接時刪除目錄)
                  asp.net listview highlight row on click(asp.net listview 在單擊時突出顯示行)
                  Calling A Button OnClick from a function(從函數調用按鈕 OnClick)
                    <legend id='2zmY2'><style id='2zmY2'><dir id='2zmY2'><q id='2zmY2'></q></dir></style></legend>
                      <tbody id='2zmY2'></tbody>

                  1. <i id='2zmY2'><tr id='2zmY2'><dt id='2zmY2'><q id='2zmY2'><span id='2zmY2'><b id='2zmY2'><form id='2zmY2'><ins id='2zmY2'></ins><ul id='2zmY2'></ul><sub id='2zmY2'></sub></form><legend id='2zmY2'></legend><bdo id='2zmY2'><pre id='2zmY2'><center id='2zmY2'></center></pre></bdo></b><th id='2zmY2'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='2zmY2'><tfoot id='2zmY2'></tfoot><dl id='2zmY2'><fieldset id='2zmY2'></fieldset></dl></div>
                      <bdo id='2zmY2'></bdo><ul id='2zmY2'></ul>
                      • <tfoot id='2zmY2'></tfoot>
                      • <small id='2zmY2'></small><noframes id='2zmY2'>

                            主站蜘蛛池模板: 欧美亚洲视频 | 久久一二区 | 欧美国产精品久久久 | 一级特黄在线 | 三级av在线 | 国产色视频网站 | 国产精品免费一区二区 | 国产精品99久久久久久宅男 | 蜜月aⅴ免费一区二区三区 99re在线视频 | 91精品久久久久 | 国产激情一区二区三区 | 亚洲一区视频在线 | 久久久久国产 | 欧美日韩一区二区三区四区 | 国产视频第一页 | 亚洲精品日韩在线观看 | 午夜在线免费观看 | 伊人二区| 精品国产乱码久久久久久牛牛 | 久久久久国产 | 亚洲 欧美 日韩 在线 | 婷婷久久精品一区二区 | 鲁大师一区影视 | 羞羞的视频免费在线观看 | 美女张开腿露出尿口 | 四虎影院美女 | 一区二区成人在线 | 亚洲成av人片在线观看 | 嫩草国产 | 欧美一级电影免费 | 国产一区二区三区四区hd | 久久久久久亚洲精品 | 久热精品免费 | 日韩伦理电影免费在线观看 | 亚洲视频在线观看 | 国产激情网 | 国产成人精品午夜视频免费 | 日韩视频1| 超碰av人人 | 美女爽到呻吟久久久久 | 成人国产精品免费观看 |