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

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

      <small id='PvYf7'></small><noframes id='PvYf7'>

        IDX10603:算法:“HS256"要求 SecurityKey.KeySize 大于

        IDX10603: The algorithm: #39;HS256#39; requires the SecurityKey.KeySize to be greater than #39;128#39; bits. KeySize reported: #39;32#39;. Parameter name: key.KeySize(IDX10603:算法:“HS256要求 SecurityKey.KeySize 大于“128位.KeySize
        <legend id='CYC5K'><style id='CYC5K'><dir id='CYC5K'><q id='CYC5K'></q></dir></style></legend>

          1. <tfoot id='CYC5K'></tfoot>
              <bdo id='CYC5K'></bdo><ul id='CYC5K'></ul>
                  <tbody id='CYC5K'></tbody>

                  <small id='CYC5K'></small><noframes id='CYC5K'>

                  <i id='CYC5K'><tr id='CYC5K'><dt id='CYC5K'><q id='CYC5K'><span id='CYC5K'><b id='CYC5K'><form id='CYC5K'><ins id='CYC5K'></ins><ul id='CYC5K'></ul><sub id='CYC5K'></sub></form><legend id='CYC5K'></legend><bdo id='CYC5K'><pre id='CYC5K'><center id='CYC5K'></center></pre></bdo></b><th id='CYC5K'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='CYC5K'><tfoot id='CYC5K'></tfoot><dl id='CYC5K'><fieldset id='CYC5K'></fieldset></dl></div>
                1. 本文介紹了IDX10603:算法:“HS256"要求 SecurityKey.KeySize 大于“128"位.KeySize 報(bào)告:'32'.參數(shù)名稱:key.KeySize的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時(shí)送ChatGPT賬號(hào)..

                  我只是在使用 Asp.Net Core Web API 并實(shí)現(xiàn)身份驗(yàn)證.我正在從 Angular 應(yīng)用程序調(diào)用這個(gè) API.但我總是收到如下錯(cuò)誤.

                  I was just working with Asp.Net Core Web API, and implementing Authentication. And I am calling this API from an Angular Application. But I am always getting an error as below.

                  IDX10603:算法:HS256"要求 SecurityKey.KeySize 大于128"位.KeySize 報(bào)告:'32'.參數(shù)名稱:key.KeySize

                  IDX10603: The algorithm: 'HS256' requires the SecurityKey.KeySize to be greater than '128' bits. KeySize reported: '32'. Parameter name: key.KeySize

                  以下是我在 Startup.cs 文件中的 ConfigureServices 代碼.

                  Below is my code for ConfigureServices in Startup.cs file.

                  public IServiceProvider ConfigureServices(IServiceCollection services)
                              {
                                  services.AddDbContext<APIContext>(option => option.UseInMemoryDatabase("AngularApp"));
                  
                                  services.AddCors(options => options.AddPolicy("Cors", builder =>
                                  {
                                      builder.AllowAnyOrigin().
                                      AllowAnyMethod().
                                      AllowAnyHeader();
                                  }
                                  ));
                  
                                  var signinKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("Secret phase"));
                  
                                  services.AddAuthentication(options =>
                                  {
                                      options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                                      options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
                                  }).AddJwtBearer(cfg =>
                                  {
                                      cfg.RequireHttpsMetadata = false;
                                      cfg.SaveToken = true;
                                      cfg.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters()
                                      {
                                          IssuerSigningKey = signinKey,
                                          ValidateAudience = false,
                                          ValidateIssuer = false,
                                          ValidateLifetime = false,
                                          ValidateIssuerSigningKey = true,
                                          ValidateActor = false,
                                          ClockSkew = TimeSpan.Zero
                                      };
                                  });
                                  services.AddMvc();
                  
                                  var serviceProvider = services.BuildServiceProvider();
                                  return serviceProvider;
                              }
                  

                  我在我的控制器中使用 JwtPackage,如下所示.

                  And I am using JwtPackagein my controller as follows.

                  JwtPackage CreateJwtToken(User usr)
                          {
                              var signinKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("this is my custom Secret key for authnetication"));
                              var signInCredentials = new SigningCredentials(signinKey, SecurityAlgorithms.HmacSha256);
                              var claims = new Claim[] {
                                  new Claim(JwtRegisteredClaimNames.Sub,usr.Id)
                              };
                              var jwt = new JwtSecurityToken(claims: claims, signingCredentials: signInCredentials);
                              var encodedJwt = new JwtSecurityTokenHandler().WriteToken(jwt);
                              return new JwtPackage() { FirstName = usr.FirstName, Token = encodedJwt };
                          }
                  

                  你能幫我解決這個(gè)問題嗎?謝謝.

                  Can you please help me to fix this issue? Thank you.

                  推薦答案

                  啊,這是我的錯(cuò)誤,一個(gè)簡單的錯(cuò)誤.我沒有為密鑰名稱提供足夠的字符.

                  Ah, it was my mistake, a simple one. I was not providing enough characters for the secret key name.

                  我把我的登錄密鑰改成了這個(gè),

                  I changed my signinkey to this one,

                  var signinKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("this is my custom Secret key for authnetication"));
                  

                  來自,

                  var signinKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("Secret phase"));
                  

                  這解決了我的問題,因?yàn)?SigningCredentials(signinKey, SecurityAlgorithms.HmacSha256) 行中的 HmacSha256 應(yīng)該大于 128 位.總之,只要用一個(gè)長字符串作為key就行了.

                  That solved my issue, as the HmacSha256 in the line SigningCredentials(signinKey, SecurityAlgorithms.HmacSha256)should be greater than 128 bits. In short, just use a long string as the key.

                  這篇關(guān)于IDX10603:算法:“HS256"要求 SecurityKey.KeySize 大于“128"位.KeySize 報(bào)告:'32'.參數(shù)名稱:key.KeySize的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

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

                          <tbody id='EwlHK'></tbody>
                          <tfoot id='EwlHK'></tfoot>

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

                            主站蜘蛛池模板: 欧美精品一区二区三区在线播放 | 欧美一区日韩一区 | 国产一区二区在线免费播放 | 国产成人精品久久二区二区91 | 北条麻妃国产九九九精品小说 | 国产蜜臀97一区二区三区 | 夜夜夜操 | 91精品国产综合久久小仙女图片 | 精品欧美一区二区精品久久久 | 中文字幕在线免费观看 | 久久新 | 久久久资源 | 亚洲天天干 | 伊人狼人影院 | 日韩精品视频在线 | 色黄爽| 国产成人精品一区二区三区网站观看 | 久久综合久色欧美综合狠狠 | 在线观看国产网站 | 中文字幕一区二区三区不卡 | 日韩一区中文字幕 | 国产成人久久精品一区二区三区 | 午夜激情影院 | 国产福利在线看 | 日韩精品一区二区三区中文在线 | 操一草 | 国产欧美精品区一区二区三区 | 欧美成年视频 | 91亚洲国产成人久久精品网站 | 久久精品一 | 欧美视频一区二区三区 | 五月婷婷在线播放 | 精精国产xxxx视频在线 | 九九久久久| 夜夜爽99久久国产综合精品女不卡 | 黄色片网站在线观看 | 黄色片在线免费看 | 亚洲自拍偷拍av | 久久综合一区 | 在线看免费的a | 国产一二三区精品视频 |