Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b89d9f31
Commit
b89d9f31
authored
Dec 21, 2023
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Jan 19, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ncrypt/tests: Add NCryptExportKey() tests.
parent
663bce9d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
ncrypt.c
dlls/ncrypt/tests/ncrypt.c
+32
-0
No files found.
dlls/ncrypt/tests/ncrypt.c
View file @
b89d9f31
...
...
@@ -798,6 +798,37 @@ static void test_NCryptEncrypt(void)
NCryptFreeObject
(
prov
);
}
static
void
test_NCryptExportKey
(
void
)
{
NCRYPT_PROV_HANDLE
prov
;
NCRYPT_KEY_HANDLE
key
;
SECURITY_STATUS
ret
;
DWORD
size
,
policy
;
BYTE
buffer
[
1024
];
ret
=
NCryptOpenStorageProvider
(
&
prov
,
NULL
,
0
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %#lx
\n
"
,
ret
);
ret
=
NCryptCreatePersistedKey
(
prov
,
&
key
,
BCRYPT_RSA_ALGORITHM
,
NULL
,
0
,
0
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %#lx
\n
"
,
ret
);
policy
=
NCRYPT_ALLOW_EXPORT_FLAG
|
NCRYPT_ALLOW_PLAINTEXT_EXPORT_FLAG
;
ret
=
NCryptSetProperty
(
key
,
NCRYPT_EXPORT_POLICY_PROPERTY
,
(
BYTE
*
)
&
policy
,
sizeof
(
policy
),
0
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %#lx
\n
"
,
ret
);
NCryptFinalizeKey
(
key
,
0
);
size
=
0
;
ret
=
NCryptExportKey
(
key
,
0
,
BCRYPT_RSAPRIVATE_BLOB
,
NULL
,
buffer
,
sizeof
(
buffer
),
&
size
,
0
);
ok
(
ret
==
ERROR_SUCCESS
,
"got unexpected return value %lx
\n
"
,
ret
);
ok
(
size
==
283
,
"got unexpected size %#lx
\n
"
,
size
);
size
=
0
;
ret
=
NCryptExportKey
(
key
,
0
,
BCRYPT_RSAFULLPRIVATE_BLOB
,
NULL
,
buffer
,
sizeof
(
buffer
),
&
size
,
0
);
ok
(
ret
==
ERROR_SUCCESS
,
"got unexpected return value %lx
\n
"
,
ret
);
ok
(
size
==
603
,
"got unexpected size %#lx
\n
"
,
size
);
NCryptFreeObject
(
key
);
NCryptFreeObject
(
prov
);
}
START_TEST
(
ncrypt
)
{
test_key_import_rsa
();
...
...
@@ -809,4 +840,5 @@ START_TEST(ncrypt)
test_verify_signature
();
test_NCryptIsAlgSupported
();
test_NCryptEncrypt
();
test_NCryptExportKey
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment