@@ -553,19 +553,46 @@ public static partial class SlhDsaTestData
553553        //
554554        // Get base64 encrypted private key info:
555555        // > openssl pkcs8 -topk8 -outform DER -v2 "aes-192-cbc" -v2prf hmacWithSHA384 -iter 10 -in private.pem | base64 -w 64
556-         public record SlhDsaGeneratedKeyInfo(
557-             int Id,
558-             SlhDsaAlgorithm Algorithm,
559-             string SecretKeyHex,
560-             string Pkcs8PrivateKeyBase64,
561-             string Pkcs8PublicKeyBase64,
562-             string Pkcs8EncryptedPrivateKeyBase64,
563-             string CertificateBase64,
564-             string SelfSignedCertificatePfxBase64,
565-             string ThumbprintHex,
566-             string EncryptionPassword,
567-             PbeParameters EncryptionParameters)
556+         public class SlhDsaGeneratedKeyInfo
568557        {
558+             public SlhDsaGeneratedKeyInfo(
559+                 int Id,
560+                 SlhDsaAlgorithm Algorithm,
561+                 string SecretKeyHex,
562+                 string Pkcs8PrivateKeyBase64,
563+                 string Pkcs8PublicKeyBase64,
564+                 string Pkcs8EncryptedPrivateKeyBase64,
565+                 string CertificateBase64,
566+                 string SelfSignedCertificatePfxBase64,
567+                 string ThumbprintHex,
568+                 string EncryptionPassword,
569+                 PbeParameters EncryptionParameters)
570+             {
571+                 this.Id = Id;
572+                 this.Algorithm = Algorithm;
573+                 this.SecretKeyHex = SecretKeyHex;
574+                 this.Pkcs8PrivateKeyBase64 = Pkcs8PrivateKeyBase64;
575+                 this.Pkcs8PublicKeyBase64 = Pkcs8PublicKeyBase64;
576+                 this.Pkcs8EncryptedPrivateKeyBase64 = Pkcs8EncryptedPrivateKeyBase64;
577+                 this.CertificateBase64 = CertificateBase64;
578+                 this.SelfSignedCertificatePfxBase64 = SelfSignedCertificatePfxBase64;
579+                 this.ThumbprintHex = ThumbprintHex;
580+                 this.EncryptionPassword = EncryptionPassword;
581+                 this.EncryptionParameters = EncryptionParameters;
582+             }
583+ 
584+             public int Id { get; }
585+             public SlhDsaAlgorithm Algorithm { get; }
586+             public string SecretKeyHex { get; }
587+             public string Pkcs8PrivateKeyBase64 { get; }
588+             public string Pkcs8PublicKeyBase64 { get; }
589+             public string Pkcs8EncryptedPrivateKeyBase64 { get; }
590+             public string CertificateBase64 { get; }
591+             public string SelfSignedCertificatePfxBase64 { get; }
592+             public string ThumbprintHex { get; }
593+             public string EncryptionPassword { get; }
594+             public PbeParameters EncryptionParameters { get; }
595+ 
569596            public byte[] SecretKey => SecretKeyHex.HexToByteArray();
570597            public byte[] PublicKey => SecretKey.AsSpan(Algorithm.SecretKeySizeInBytes/2).ToArray();
571598            public byte[] Pkcs8PrivateKey => Convert.FromBase64String(Pkcs8PrivateKeyBase64);
@@ -574,9 +601,9 @@ public record SlhDsaGeneratedKeyInfo(
574601            public byte[] EncryptionPasswordBytes => Encoding.UTF8.GetBytes(EncryptionPassword); // Assuming UTF-8 encoding
575602            public byte[] Certificate => Convert.FromBase64String(CertificateBase64);
576603            public byte[] SelfSignedCertificatePfx => Convert.FromBase64String(SelfSignedCertificatePfxBase64);
577-             public string EncryptedPem => PemEncoding.WriteString ("ENCRYPTED PRIVATE KEY", Pkcs8EncryptedPrivateKey);
578-             public string PrivateKeyPem => PemEncoding.WriteString ("PRIVATE KEY", Pkcs8PrivateKey);
579-             public string PublicKeyPem => PemEncoding.WriteString ("PUBLIC KEY", Pkcs8PublicKey);
604+             public string EncryptedPem => ByteUtils.PemEncode ("ENCRYPTED PRIVATE KEY", Pkcs8EncryptedPrivateKey);
605+             public string PrivateKeyPem => ByteUtils.PemEncode ("PRIVATE KEY", Pkcs8PrivateKey);
606+             public string PublicKeyPem => ByteUtils.PemEncode ("PUBLIC KEY", Pkcs8PublicKey);
580607            public byte[] Thumbprint => ThumbprintHex.HexToByteArray();
581608
582609            public override string ToString() =>
@@ -588,16 +615,35 @@ from info in GeneratedKeyInfosRaw
588615            select new object[] { info };
589616
590617        public static partial SlhDsaGeneratedKeyInfo[] GeneratedKeyInfosRaw { get; }
591- 
592-         public record SlhDsaKeyGenTestVector(
593-             int TestCaseId,
594-             SlhDsaAlgorithm Algorithm,
595-             string SecretKeySeedHex,
596-             string SecretKeyPrfHex,
597-             string PublicKeySeedHex,
598-             string SecretKeyHex,
599-             string PublicKeyHex)
618+         
619+         public class SlhDsaKeyGenTestVector
600620        {
621+             public SlhDsaKeyGenTestVector(
622+                 int TestCaseId,
623+                 SlhDsaAlgorithm Algorithm,
624+                 string SecretKeySeedHex,
625+                 string SecretKeyPrfHex,
626+                 string PublicKeySeedHex,
627+                 string SecretKeyHex,
628+                 string PublicKeyHex)
629+             {
630+                 this.TestCaseId = TestCaseId;
631+                 this.Algorithm = Algorithm;
632+                 this.SecretKeySeedHex = SecretKeySeedHex;
633+                 this.SecretKeyPrfHex = SecretKeyPrfHex;
634+                 this.PublicKeySeedHex = PublicKeySeedHex;
635+                 this.SecretKeyHex = SecretKeyHex;
636+                 this.PublicKeyHex = PublicKeyHex;
637+             }
638+ 
639+             public int TestCaseId { get; }
640+             public SlhDsaAlgorithm Algorithm { get; }
641+             public string SecretKeySeedHex { get; }
642+             public string SecretKeyPrfHex { get; }
643+             public string PublicKeySeedHex { get; }
644+             public string SecretKeyHex { get; }
645+             public string PublicKeyHex { get; }
646+ 
601647            public byte[] SecretKeySeed => SecretKeySeedHex.HexToByteArray();
602648            public byte[] SecretKeyPrf => SecretKeyPrfHex.HexToByteArray();
603649            public byte[] PublicKeySeed => PublicKeySeedHex.HexToByteArray();
@@ -722,16 +768,37 @@ public record SlhDsaKeyGenTestVector(
722768            ),
723769        ];
724770
725-         public record SlhDsaSigVerTestVector(
726-             int TestCaseId,
727-             bool TestPassed,
728-             SlhDsaAlgorithm Algorithm,
729-             string SecretKeyHex,
730-             string PublicKeyHex,
731-             string MessageHex,
732-             string ContextHex,
733-             string SignatureHex)
771+         public class SlhDsaSigVerTestVector
734772        {
773+             public SlhDsaSigVerTestVector(
774+                 int TestCaseId,
775+                 bool TestPassed,
776+                 SlhDsaAlgorithm Algorithm,
777+                 string SecretKeyHex,
778+                 string PublicKeyHex,
779+                 string MessageHex,
780+                 string ContextHex,
781+                 string SignatureHex)
782+             {
783+                 this.TestCaseId = TestCaseId;
784+                 this.TestPassed = TestPassed;
785+                 this.Algorithm = Algorithm;
786+                 this.SecretKeyHex = SecretKeyHex;
787+                 this.PublicKeyHex = PublicKeyHex;
788+                 this.MessageHex = MessageHex;
789+                 this.ContextHex = ContextHex;
790+                 this.SignatureHex = SignatureHex;
791+             }
792+ 
793+             public int TestCaseId { get; }
794+             public bool TestPassed { get; }
795+             public SlhDsaAlgorithm Algorithm { get; }
796+             public string SecretKeyHex { get; }
797+             public string PublicKeyHex { get; }
798+             public string MessageHex { get; }
799+             public string ContextHex { get; }
800+             public string SignatureHex { get; }
801+ 
735802            public byte[] SecretKey => SecretKeyHex.HexToByteArray();
736803            public byte[] PublicKey => PublicKeyHex.HexToByteArray();
737804            public byte[] Message => MessageHex.HexToByteArray();
0 commit comments