public static void SignatureAlgorithm_Encoding(string hashAlgorithmName)
        {
            string expectedAlgOid;

            switch (hashAlgorithmName)
            {
            case "SHA1":
                expectedAlgOid = "06072A8648CE3D0401";
                break;

            case "SHA256":
                expectedAlgOid = "06082A8648CE3D040302";
                break;

            case "SHA384":
                expectedAlgOid = "06082A8648CE3D040303";
                break;

            case "SHA512":
                expectedAlgOid = "06082A8648CE3D040304";
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(hashAlgorithmName));
            }

            EccTestData testData = EccTestData.Secp521r1Data;

            string expectedHex = $"30{(expectedAlgOid.Length / 2):X2}{expectedAlgOid}";

            using (ECDsa ecdsa = ECDsa.Create(testData.KeyParameters))
            {
                var    generator = X509SignatureGenerator.CreateForECDsa(ecdsa);
                byte[] sigAlg    = generator.GetSignatureAlgorithmIdentifier(new HashAlgorithmName(hashAlgorithmName));

                Assert.Equal(expectedHex, sigAlg.ByteArrayToHex());
            }
        }
 public static IEnumerable <object[]> GetApplicableTestData()
 {
     return(EccTestData.EnumerateApplicableTests().Select(x => new object[] { x }));
 }