Example #1
0
        internal override int ExportKey(
            SecureMemoryHandle keyHandle,
            KeyBlobFormat format,
            Span <byte> blob)
        {
            switch (format)
            {
            case KeyBlobFormat.RawPrivateKey:
                return(s_rawPrivateKeyFormatter.Export(keyHandle, blob));

            case KeyBlobFormat.NSecPrivateKey:
                return(s_nsecPrivateKeyFormatter.Export(keyHandle, blob));

            case KeyBlobFormat.PkixPrivateKey:
                return(s_pkixPrivateKeyFormatter.Export(keyHandle, blob));

            case KeyBlobFormat.PkixPrivateKeyText:
                return(s_pkixPrivateKeyFormatter.ExportText(keyHandle, blob));

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