From 0743354ff5fe9c4fe206e6ead05c58a905d9e049 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Sun, 27 Sep 2020 08:35:24 -0400 Subject: [PATCH] Remove unnecessary byte[] allocation from CertificateRequest.CreateSelfSigned (#42776) --- .../System/Security/Cryptography/X509Certificates/CertificateRequest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs index 9f4bf54..d1c6fc4 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs @@ -308,7 +308,7 @@ namespace System.Security.Cryptography.X509Certificates Debug.Assert(_generator != null); - byte[] serialNumber = new byte[8]; + Span serialNumber = stackalloc byte[8]; RandomNumberGenerator.Fill(serialNumber); using (X509Certificate2 certificate = Create( -- 2.7.4