-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding wrappers to Cryptui/Crypt32 and structures to WinCrypt. #915
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
353 changes: 351 additions & 2 deletions
353
contrib/platform/src/com/sun/jna/platform/win32/Crypt32.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
contrib/platform/src/com/sun/jna/platform/win32/Cryptui.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* Copyright (c) 2018 Roshan Muralidharan, All Rights Reserved | ||
* | ||
* The contents of this file is dual-licensed under 2 | ||
* alternative Open Source/Free licenses: LGPL 2.1 or later and | ||
* Apache License 2.0. (starting with JNA version 4.0.0). | ||
* | ||
* You can freely decide which license you want to apply to | ||
* the project. | ||
* | ||
* You may obtain a copy of the LGPL License at: | ||
* | ||
* http://www.gnu.org/licenses/licenses.html | ||
* | ||
* A copy is also included in the downloadable source code package | ||
* containing JNA, in file "LGPL2.1". | ||
* | ||
* You may obtain a copy of the Apache License at: | ||
* | ||
* http://www.apache.org/licenses/ | ||
* | ||
* A copy is also included in the downloadable source code package | ||
* containing JNA, in file "AL2.0". | ||
*/ | ||
package com.sun.jna.platform.win32; | ||
|
||
import com.sun.jna.Native; | ||
import com.sun.jna.PointerType; | ||
import com.sun.jna.platform.win32.WinDef.HWND; | ||
import com.sun.jna.platform.win32.WinNT.HANDLE; | ||
import com.sun.jna.win32.StdCallLibrary; | ||
import com.sun.jna.win32.W32APIOptions; | ||
import com.sun.jna.platform.win32.WinCrypt.*; | ||
|
||
/** | ||
* Cryptui.dll Interface. | ||
* @author roshan[dot]muralidharan[at]cerner[dot]com | ||
*/ | ||
public interface Cryptui extends StdCallLibrary { | ||
|
||
Cryptui INSTANCE = (Cryptui) Native.loadLibrary("Cryptui", Cryptui.class, W32APIOptions.UNICODE_OPTIONS); | ||
|
||
/** | ||
* The CryptUIDlgSelectCertificateFromStore function displays a dialog box that | ||
* allows the selection of a certificate from a specified store. | ||
* | ||
* @param hCertStore | ||
* Handle of the certificate store to be searched. | ||
* @param hwnd | ||
* Handle of the window for the display. If NULL, defaults to the | ||
* desktop window. | ||
* @param pwszTitle | ||
* String used as the title of the dialog box. If NULL, the default | ||
* title, "Select Certificate," is used. | ||
* @param pwszDisplayString | ||
* Text statement in the selection dialog box. If NULL, the default | ||
* phrase, "Select a certificate you want to use," is used. | ||
* @param dwDontUseColumn | ||
* Flags that can be combined to exclude columns of the display. | ||
* @param dwFlags | ||
* Currently not used and should be set to 0. | ||
* @param pvReserved | ||
* Reserved for future use. | ||
* @return Returns a pointer to the selected certificate context. If no | ||
* certificate was selected, NULL is returned. When you have finished | ||
* using the certificate, free the certificate context by calling the | ||
* CertFreeCertificateContext function. | ||
*/ | ||
CERT_CONTEXT.ByReference CryptUIDlgSelectCertificateFromStore(HCERTSTORE hCertStore, HWND hwnd, String pwszTitle, | ||
String pwszDisplayString, int dwDontUseColumn, int dwFlags, PointerType pvReserved); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure you don't extend BSTR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is correct. The inner class
LPSTR.ByReference
is aLPSTR
class marked asByReference
(the latter is a marker interface, that forces JNA to pass the value as a reference).