Skip to content

Commit 9cf06a1

Browse files
Make 256-bit more explicit
Use 256/8 instead of 32 to make it clearer why the buffer is the size it is.
1 parent 9efb439 commit 9cf06a1

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

src/AspNet.Security.OAuth.Alipay/AlipayAuthenticationHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ protected override string BuildChallengeUrl([NotNull] AuthenticationProperties p
220220

221221
if (Options.UsePkce)
222222
{
223-
byte[] bytes = RandomNumberGenerator.GetBytes(32);
223+
byte[] bytes = RandomNumberGenerator.GetBytes(256 / 8);
224224
string codeVerifier = WebEncoders.Base64UrlEncode(bytes);
225225

226226
// Store this for use during the code redemption.

src/AspNet.Security.OAuth.Deezer/DeezerAuthenticationHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ protected override string BuildChallengeUrl([NotNull] AuthenticationProperties p
101101

102102
if (Options.UsePkce)
103103
{
104-
byte[] bytes = RandomNumberGenerator.GetBytes(32);
104+
byte[] bytes = RandomNumberGenerator.GetBytes(256 / 8);
105105
string codeVerifier = WebEncoders.Base64UrlEncode(bytes);
106106

107107
// Store this for use during the code redemption.

src/AspNet.Security.OAuth.Mixcloud/MixcloudAuthenticationHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected override string BuildChallengeUrl([NotNull] AuthenticationProperties p
4141

4242
if (Options.UsePkce)
4343
{
44-
var bytes = RandomNumberGenerator.GetBytes(32);
44+
var bytes = RandomNumberGenerator.GetBytes(256 / 8);
4545
var codeVerifier = WebEncoders.Base64UrlEncode(bytes);
4646

4747
// Store this for use during the code redemption.

src/AspNet.Security.OAuth.Shopify/ShopifyAuthenticationHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ protected override string BuildChallengeUrl([NotNull] AuthenticationProperties p
118118

119119
if (Options.UsePkce)
120120
{
121-
byte[] bytes = RandomNumberGenerator.GetBytes(32);
121+
byte[] bytes = RandomNumberGenerator.GetBytes(256 / 8);
122122
string codeVerifier = WebEncoders.Base64UrlEncode(bytes);
123123

124124
// Store this for use during the code redemption.

src/AspNet.Security.OAuth.Weixin/WeixinAuthenticationHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ protected override string BuildChallengeUrl([NotNull] AuthenticationProperties p
138138

139139
if (Options.UsePkce)
140140
{
141-
var bytes = RandomNumberGenerator.GetBytes(32);
141+
var bytes = RandomNumberGenerator.GetBytes(256 / 8);
142142
var codeVerifier = WebEncoders.Base64UrlEncode(bytes);
143143

144144
// Store this for use during the code redemption.

src/AspNet.Security.OAuth.WorkWeixin/WorkWeixinAuthenticationHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ protected override string BuildChallengeUrl([NotNull] AuthenticationProperties p
111111

112112
if (Options.UsePkce)
113113
{
114-
var bytes = RandomNumberGenerator.GetBytes(32);
114+
var bytes = RandomNumberGenerator.GetBytes(256 / 8);
115115
var codeVerifier = WebEncoders.Base64UrlEncode(bytes);
116116

117117
// Store this for use during the code redemption.

0 commit comments

Comments
 (0)