Esempio n. 1
0
        internal override int ExportKey(
            SecureMemoryHandle keyHandle,
            KeyBlobFormat format,
            Span <byte> blob)
        {
            Debug.Assert(keyHandle != null);

            switch (format)
            {
            case KeyBlobFormat.RawSymmetricKey:
                return(s_rawKeyFormatter.Export(keyHandle, blob));

            case KeyBlobFormat.NSecSymmetricKey:
                return(s_nsecKeyFormatter.Export(keyHandle, blob));

            default:
                throw Error.Argument_FormatNotSupported(nameof(format), format.ToString());
            }
        }
Esempio n. 2
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());
            }
        }