Пример #1
0
        public static PublicKey Import(
            Algorithm algorithm,
            ReadOnlySpan <byte> blob,
            KeyBlobFormat format)
        {
            if (algorithm == null)
            {
                throw Error.ArgumentNull_Algorithm(nameof(algorithm));
            }

            if (!algorithm.TryImportPublicKey(blob, format, out byte[] publicKeyBytes))
Пример #2
0
        public static PublicKey Import(
            Algorithm algorithm,
            ReadOnlySpan <byte> blob,
            KeyBlobFormat format)
        {
            if (algorithm == null)
            {
                throw Error.ArgumentNull_Algorithm(nameof(algorithm));
            }

            if (!algorithm.TryImportPublicKey(blob, format, out PublicKey publicKey))
            {
                throw Error.Format_InvalidBlob();
            }

            return(publicKey);
        }
Пример #3
0
        public static bool TryImport(
            Algorithm algorithm,
            ReadOnlySpan <byte> blob,
            KeyBlobFormat format,
            out PublicKey result)
        {
            if (algorithm == null)
            {
                throw Error.ArgumentNull_Algorithm(nameof(algorithm));
            }

            if (!algorithm.TryImportPublicKey(blob, format, out PublicKey publicKey))
            {
                result = null;
                return(false);
            }

            result = publicKey;
            return(true);
        }