Skip to content

Commit 3d93e1d

Browse files
committed
Cleanups
1 parent 53fab4f commit 3d93e1d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Servers/Kestrel/Core/src/Middleware/HttpsConnectionMiddleware.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using System.Net.Security;
99
using System.Runtime.InteropServices;
1010
using System.Security.Authentication;
11-
using System.Security.Cryptography;
1211
using System.Security.Cryptography.X509Certificates;
1312
using System.Threading;
1413
using System.Threading.Tasks;

src/Shared/CertificateGeneration/CertificateManager.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,9 @@ internal static bool CheckDeveloperCertificateKey(X509Certificate2 candidate)
259259
// with the certificate at some point.
260260
var value = new byte[32];
261261
RandomNumberGenerator.Fill(value);
262-
rsa.Encrypt(value, RSAEncryptionPadding.Pkcs1);
262+
rsa.Decrypt(rsa.Encrypt(value, RSAEncryptionPadding.Pkcs1), RSAEncryptionPadding.Pkcs1);
263+
264+
// Being able to encrypt and decrypt a payload is the strongest guarantee that the key is valid.
263265
return true;
264266
}
265267
catch (Exception)

0 commit comments

Comments
 (0)