예제 #1
0
파일: Ed25519.cs 프로젝트: wandbond/nsec
        internal override bool TryImportKey(
            ReadOnlySpan <byte> blob,
            KeyBlobFormat format,
            out SecureMemoryHandle keyHandle,
            out byte[] publicKeyBytes)
        {
            switch (format)
            {
            case KeyBlobFormat.RawPrivateKey:
                return(s_rawPrivateKeyFormatter.TryImport(blob, out keyHandle, out publicKeyBytes));

            case KeyBlobFormat.NSecPrivateKey:
                return(s_nsecPrivateKeyFormatter.TryImport(blob, out keyHandle, out publicKeyBytes));

            case KeyBlobFormat.PkixPrivateKey:
                return(s_pkixPrivateKeyFormatter.TryImport(blob, out keyHandle, out publicKeyBytes));

            case KeyBlobFormat.PkixPrivateKeyText:
                return(s_pkixPrivateKeyFormatter.TryImportText(blob, out keyHandle, out publicKeyBytes));

            default:
                throw Error.Argument_FormatNotSupported(nameof(format), format.ToString());
            }
        }