Hans Leidekker : dssenh: Add support for exporting private keys.

Alexandre Julliard julliard at winehq.org
Mon Oct 19 15:54:06 CDT 2020


Module: wine
Branch: master
Commit: b4ca2d001c31c4a7805135549eddc5844b60e319
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b4ca2d001c31c4a7805135549eddc5844b60e319

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Mon Oct 19 11:24:16 2020 +0200

dssenh: Add support for exporting private keys.

Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dssenh/main.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/dlls/dssenh/main.c b/dlls/dssenh/main.c
index 1da56493170..e3771dc6f06 100644
--- a/dlls/dssenh/main.c
+++ b/dlls/dssenh/main.c
@@ -578,6 +578,7 @@ BOOL WINAPI CPExportKey( HCRYPTPROV hprov, HCRYPTKEY hkey, HCRYPTKEY hexpkey, DW
                          BYTE *data, DWORD *len )
 {
     struct key *key = (struct key *)hkey;
+    const WCHAR *type;
 
     TRACE( "%p, %p, %p, %08x, %08x, %p, %p\n", (void *)hprov, (void *)hkey, (void *)hexpkey, blobtype, flags,
            data, len );
@@ -588,18 +589,28 @@ BOOL WINAPI CPExportKey( HCRYPTPROV hprov, HCRYPTKEY hkey, HCRYPTKEY hexpkey, DW
         FIXME( "export key not supported\n" );
         return FALSE;
     }
-    if (blobtype != PUBLICKEYBLOB)
+    if (flags)
     {
-        FIXME( "blob type %u not supported\n", blobtype );
+        FIXME( "flags %08x not supported\n", flags );
         return FALSE;
     }
-    if (flags)
+
+    switch (blobtype)
     {
-        FIXME( "flags %08x not supported\n", flags );
+    case PUBLICKEYBLOB:
+        type = LEGACY_DSA_V2_PUBLIC_BLOB;
+        break;
+
+    case PRIVATEKEYBLOB:
+        type = LEGACY_DSA_V2_PRIVATE_BLOB;
+        break;
+
+    default:
+        FIXME( "blob type %u not supported\n", blobtype );
         return FALSE;
     }
 
-    return !BCryptExportKey( key->handle, NULL, LEGACY_DSA_V2_PUBLIC_BLOB, data, *len, len, 0 );
+    return !BCryptExportKey( key->handle, NULL, type, data, *len, len, 0 );
 }
 
 BOOL WINAPI CPDuplicateKey( HCRYPTPROV hprov, HCRYPTKEY hkey, DWORD *reserved, DWORD flags, HCRYPTKEY *ret_key )




More information about the wine-cvs mailing list