Exemplo n.º 1
0
        /// <summary>Tries to parse a <see cref="string"/> into a <see cref="EllipticalCurve"/>.</summary>
        public static bool TryParse(string crv, out EllipticalCurve curve)
        {
            switch (crv)
            {
            case "P-256":
                curve = P256;
                goto Parsed;

            case "P-384":
                curve = P384;
                goto Parsed;

            case "P-521":
                curve = P521;
                goto Parsed;

            case "secp256k1":
                curve = Secp256k1;
                goto Parsed;

            default:
                curve = default;
                return(false);
            }

Parsed:
            return(true);
        }
Exemplo n.º 2
0
 private static Exception CreateNotSupportedException_SignatureAlgorithm(SignatureAlgorithm?algorithm, EllipticalCurve curve) => new NotSupportedException($"Signature failed. No support for: Algorithm: '{algorithm}' with curve '{curve}'.");
Exemplo n.º 3
0
 internal static void ThrowNotSupportedException_SignatureAlgorithm(SignatureAlgorithm?algorithm, EllipticalCurve curve) => throw CreateNotSupportedException_SignatureAlgorithm(algorithm, curve);