23 #include <winpr/platform.h>
24 #include <winpr/winpr.h>
25 #include <winpr/wtypes.h>
26 #include <winpr/windows.h>
27 #include <winpr/security.h>
34 #define SECURITY_WIN32
40 #if !defined(_WIN32) || defined(_UWP)
46 typedef CHAR SEC_CHAR;
47 typedef WCHAR SEC_WCHAR;
58 WINPR_PRAGMA_DIAG_PUSH
59 WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO
61 #ifndef __SECSTATUS_DEFINED__
62 typedef LONG SECURITY_STATUS;
63 #define __SECSTATUS_DEFINED__
91 #define SecPkgInfo SecPkgInfoW
92 #define PSecPkgInfo PSecPkgInfoW
94 #define SecPkgInfo SecPkgInfoA
95 #define PSecPkgInfo PSecPkgInfoA
100 #define NTLM_SSP_NAME _T("NTLM")
101 #define KERBEROS_SSP_NAME _T("Kerberos")
102 #define NEGO_SSP_NAME _T("Negotiate")
104 #define SECPKG_ID_NONE 0xFFFF
106 #define SECPKG_FLAG_INTEGRITY 0x00000001
107 #define SECPKG_FLAG_PRIVACY 0x00000002
108 #define SECPKG_FLAG_TOKEN_ONLY 0x00000004
109 #define SECPKG_FLAG_DATAGRAM 0x00000008
110 #define SECPKG_FLAG_CONNECTION 0x00000010
111 #define SECPKG_FLAG_MULTI_REQUIRED 0x00000020
112 #define SECPKG_FLAG_CLIENT_ONLY 0x00000040
113 #define SECPKG_FLAG_EXTENDED_ERROR 0x00000080
114 #define SECPKG_FLAG_IMPERSONATION 0x00000100
115 #define SECPKG_FLAG_ACCEPT_WIN32_NAME 0x00000200
116 #define SECPKG_FLAG_STREAM 0x00000400
117 #define SECPKG_FLAG_NEGOTIABLE 0x00000800
118 #define SECPKG_FLAG_GSS_COMPATIBLE 0x00001000
119 #define SECPKG_FLAG_LOGON 0x00002000
120 #define SECPKG_FLAG_ASCII_BUFFERS 0x00004000
121 #define SECPKG_FLAG_FRAGMENT 0x00008000
122 #define SECPKG_FLAG_MUTUAL_AUTH 0x00010000
123 #define SECPKG_FLAG_DELEGATION 0x00020000
124 #define SECPKG_FLAG_READONLY_WITH_CHECKSUM 0x00040000
125 #define SECPKG_FLAG_RESTRICTED_TOKENS 0x00080000
126 #define SECPKG_FLAG_NEGO_EXTENDER 0x00100000
127 #define SECPKG_FLAG_NEGOTIABLE2 0x00200000
131 #define SEC_E_OK (SECURITY_STATUS)0x00000000L
132 #define SEC_E_INSUFFICIENT_MEMORY (SECURITY_STATUS)0x80090300L
133 #define SEC_E_INVALID_HANDLE (SECURITY_STATUS)0x80090301L
134 #define SEC_E_UNSUPPORTED_FUNCTION (SECURITY_STATUS)0x80090302L
135 #define SEC_E_TARGET_UNKNOWN (SECURITY_STATUS)0x80090303L
136 #define SEC_E_INTERNAL_ERROR (SECURITY_STATUS)0x80090304L
137 #define SEC_E_SECPKG_NOT_FOUND (SECURITY_STATUS)0x80090305L
138 #define SEC_E_NOT_OWNER (SECURITY_STATUS)0x80090306L
139 #define SEC_E_CANNOT_INSTALL (SECURITY_STATUS)0x80090307L
140 #define SEC_E_INVALID_TOKEN (SECURITY_STATUS)0x80090308L
141 #define SEC_E_CANNOT_PACK (SECURITY_STATUS)0x80090309L
142 #define SEC_E_QOP_NOT_SUPPORTED (SECURITY_STATUS)0x8009030AL
143 #define SEC_E_NO_IMPERSONATION (SECURITY_STATUS)0x8009030BL
144 #define SEC_E_LOGON_DENIED (SECURITY_STATUS)0x8009030CL
145 #define SEC_E_UNKNOWN_CREDENTIALS (SECURITY_STATUS)0x8009030DL
146 #define SEC_E_NO_CREDENTIALS (SECURITY_STATUS)0x8009030EL
147 #define SEC_E_MESSAGE_ALTERED (SECURITY_STATUS)0x8009030FL
148 #define SEC_E_OUT_OF_SEQUENCE (SECURITY_STATUS)0x80090310L
149 #define SEC_E_NO_AUTHENTICATING_AUTHORITY (SECURITY_STATUS)0x80090311L
150 #define SEC_E_BAD_PKGID (SECURITY_STATUS)0x80090316L
151 #define SEC_E_CONTEXT_EXPIRED (SECURITY_STATUS)0x80090317L
152 #define SEC_E_INCOMPLETE_MESSAGE (SECURITY_STATUS)0x80090318L
153 #define SEC_E_INCOMPLETE_CREDENTIALS (SECURITY_STATUS)0x80090320L
154 #define SEC_E_BUFFER_TOO_SMALL (SECURITY_STATUS)0x80090321L
155 #define SEC_E_WRONG_PRINCIPAL (SECURITY_STATUS)0x80090322L
156 #define SEC_E_TIME_SKEW (SECURITY_STATUS)0x80090324L
157 #define SEC_E_UNTRUSTED_ROOT (SECURITY_STATUS)0x80090325L
158 #define SEC_E_ILLEGAL_MESSAGE (SECURITY_STATUS)0x80090326L
159 #define SEC_E_CERT_UNKNOWN (SECURITY_STATUS)0x80090327L
160 #define SEC_E_CERT_EXPIRED (SECURITY_STATUS)0x80090328L
161 #define SEC_E_ENCRYPT_FAILURE (SECURITY_STATUS)0x80090329L
162 #define SEC_E_DECRYPT_FAILURE (SECURITY_STATUS)0x80090330L
163 #define SEC_E_ALGORITHM_MISMATCH (SECURITY_STATUS)0x80090331L
164 #define SEC_E_SECURITY_QOS_FAILED (SECURITY_STATUS)0x80090332L
165 #define SEC_E_UNFINISHED_CONTEXT_DELETED (SECURITY_STATUS)0x80090333L
166 #define SEC_E_NO_TGT_REPLY (SECURITY_STATUS)0x80090334L
167 #define SEC_E_NO_IP_ADDRESSES (SECURITY_STATUS)0x80090335L
168 #define SEC_E_WRONG_CREDENTIAL_HANDLE (SECURITY_STATUS)0x80090336L
169 #define SEC_E_CRYPTO_SYSTEM_INVALID (SECURITY_STATUS)0x80090337L
170 #define SEC_E_MAX_REFERRALS_EXCEEDED (SECURITY_STATUS)0x80090338L
171 #define SEC_E_MUST_BE_KDC (SECURITY_STATUS)0x80090339L
172 #define SEC_E_STRONG_CRYPTO_NOT_SUPPORTED (SECURITY_STATUS)0x8009033AL
173 #define SEC_E_TOO_MANY_PRINCIPALS (SECURITY_STATUS)0x8009033BL
174 #define SEC_E_NO_PA_DATA (SECURITY_STATUS)0x8009033CL
175 #define SEC_E_PKINIT_NAME_MISMATCH (SECURITY_STATUS)0x8009033DL
176 #define SEC_E_SMARTCARD_LOGON_REQUIRED (SECURITY_STATUS)0x8009033EL
177 #define SEC_E_SHUTDOWN_IN_PROGRESS (SECURITY_STATUS)0x8009033FL
178 #define SEC_E_KDC_INVALID_REQUEST (SECURITY_STATUS)0x80090340L
179 #define SEC_E_KDC_UNABLE_TO_REFER (SECURITY_STATUS)0x80090341L
180 #define SEC_E_KDC_UNKNOWN_ETYPE (SECURITY_STATUS)0x80090342L
181 #define SEC_E_UNSUPPORTED_PREAUTH (SECURITY_STATUS)0x80090343L
182 #define SEC_E_DELEGATION_REQUIRED (SECURITY_STATUS)0x80090345L
183 #define SEC_E_BAD_BINDINGS (SECURITY_STATUS)0x80090346L
184 #define SEC_E_MULTIPLE_ACCOUNTS (SECURITY_STATUS)0x80090347L
185 #define SEC_E_NO_KERB_KEY (SECURITY_STATUS)0x80090348L
186 #define SEC_E_CERT_WRONG_USAGE (SECURITY_STATUS)0x80090349L
187 #define SEC_E_DOWNGRADE_DETECTED (SECURITY_STATUS)0x80090350L
188 #define SEC_E_SMARTCARD_CERT_REVOKED (SECURITY_STATUS)0x80090351L
189 #define SEC_E_ISSUING_CA_UNTRUSTED (SECURITY_STATUS)0x80090352L
190 #define SEC_E_REVOCATION_OFFLINE_C (SECURITY_STATUS)0x80090353L
191 #define SEC_E_PKINIT_CLIENT_FAILURE (SECURITY_STATUS)0x80090354L
192 #define SEC_E_SMARTCARD_CERT_EXPIRED (SECURITY_STATUS)0x80090355L
193 #define SEC_E_NO_S4U_PROT_SUPPORT (SECURITY_STATUS)0x80090356L
194 #define SEC_E_CROSSREALM_DELEGATION_FAILURE (SECURITY_STATUS)0x80090357L
195 #define SEC_E_REVOCATION_OFFLINE_KDC (SECURITY_STATUS)0x80090358L
196 #define SEC_E_ISSUING_CA_UNTRUSTED_KDC (SECURITY_STATUS)0x80090359L
197 #define SEC_E_KDC_CERT_EXPIRED (SECURITY_STATUS)0x8009035AL
198 #define SEC_E_KDC_CERT_REVOKED (SECURITY_STATUS)0x8009035BL
199 #define SEC_E_INVALID_PARAMETER (SECURITY_STATUS)0x8009035DL
200 #define SEC_E_DELEGATION_POLICY (SECURITY_STATUS)0x8009035EL
201 #define SEC_E_POLICY_NLTM_ONLY (SECURITY_STATUS)0x8009035FL
202 #define SEC_E_NO_CONTEXT (SECURITY_STATUS)0x80090361L
203 #define SEC_E_PKU2U_CERT_FAILURE (SECURITY_STATUS)0x80090362L
204 #define SEC_E_MUTUAL_AUTH_FAILED (SECURITY_STATUS)0x80090363L
206 #define SEC_I_CONTINUE_NEEDED (SECURITY_STATUS)0x00090312L
207 #define SEC_I_COMPLETE_NEEDED (SECURITY_STATUS)0x00090313L
208 #define SEC_I_COMPLETE_AND_CONTINUE (SECURITY_STATUS)0x00090314L
209 #define SEC_I_LOCAL_LOGON (SECURITY_STATUS)0x00090315L
210 #define SEC_I_CONTEXT_EXPIRED (SECURITY_STATUS)0x00090317L
211 #define SEC_I_INCOMPLETE_CREDENTIALS (SECURITY_STATUS)0x00090320L
212 #define SEC_I_RENEGOTIATE (SECURITY_STATUS)0x00090321L
213 #define SEC_I_NO_LSA_CONTEXT (SECURITY_STATUS)0x00090323L
214 #define SEC_I_SIGNATURE_NEEDED (SECURITY_STATUS)0x0009035CL
215 #define SEC_I_NO_RENEGOTIATION (SECURITY_STATUS)0x00090360L
220 #ifndef SEC_E_INVALID_PARAMETER
221 #define SEC_E_INVALID_PARAMETER (SECURITY_STATUS)0x8009035DL
224 #ifndef SEC_E_DELEGATION_POLICY
225 #define SEC_E_DELEGATION_POLICY (SECURITY_STATUS)0x8009035EL
228 #ifndef SEC_E_POLICY_NLTM_ONLY
229 #define SEC_E_POLICY_NLTM_ONLY (SECURITY_STATUS)0x8009035FL
232 #ifndef SEC_E_NO_CONTEXT
233 #define SEC_E_NO_CONTEXT (SECURITY_STATUS)0x80090361L
236 #ifndef SEC_E_PKU2U_CERT_FAILURE
237 #define SEC_E_PKU2U_CERT_FAILURE (SECURITY_STATUS)0x80090362L
240 #ifndef SEC_E_MUTUAL_AUTH_FAILED
241 #define SEC_E_MUTUAL_AUTH_FAILED (SECURITY_STATUS)0x80090363L
244 #ifndef SEC_I_SIGNATURE_NEEDED
245 #define SEC_I_SIGNATURE_NEEDED (SECURITY_STATUS)0x0009035CL
248 #ifndef SEC_I_NO_RENEGOTIATION
249 #define SEC_I_NO_RENEGOTIATION (SECURITY_STATUS)0x00090360L
254 #define SECURITY_NATIVE_DREP 0x00000010
255 #define SECURITY_NETWORK_DREP 0x00000000
257 #define SECPKG_CRED_INBOUND 0x00000001
258 #define SECPKG_CRED_OUTBOUND 0x00000002
259 #define SECPKG_CRED_BOTH 0x00000003
260 #define SECPKG_CRED_AUTOLOGON_RESTRICTED 0x00000010
261 #define SECPKG_CRED_PROCESS_POLICY_ONLY 0x00000020
265 #define SECPKG_ATTR_SIZES 0
266 #define SECPKG_ATTR_NAMES 1
267 #define SECPKG_ATTR_LIFESPAN 2
268 #define SECPKG_ATTR_DCE_INFO 3
269 #define SECPKG_ATTR_STREAM_SIZES 4
270 #define SECPKG_ATTR_KEY_INFO 5
271 #define SECPKG_ATTR_AUTHORITY 6
272 #define SECPKG_ATTR_PROTO_INFO 7
273 #define SECPKG_ATTR_PASSWORD_EXPIRY 8
274 #define SECPKG_ATTR_SESSION_KEY 9
275 #define SECPKG_ATTR_PACKAGE_INFO 10
276 #define SECPKG_ATTR_USER_FLAGS 11
277 #define SECPKG_ATTR_NEGOTIATION_INFO 12
278 #define SECPKG_ATTR_NATIVE_NAMES 13
279 #define SECPKG_ATTR_FLAGS 14
280 #define SECPKG_ATTR_USE_VALIDATED 15
281 #define SECPKG_ATTR_CREDENTIAL_NAME 16
282 #define SECPKG_ATTR_TARGET_INFORMATION 17
283 #define SECPKG_ATTR_ACCESS_TOKEN 18
284 #define SECPKG_ATTR_TARGET 19
285 #define SECPKG_ATTR_AUTHENTICATION_ID 20
286 #define SECPKG_ATTR_LOGOFF_TIME 21
287 #define SECPKG_ATTR_NEGO_KEYS 22
288 #define SECPKG_ATTR_PROMPTING_NEEDED 24
289 #define SECPKG_ATTR_UNIQUE_BINDINGS 25
290 #define SECPKG_ATTR_ENDPOINT_BINDINGS 26
291 #define SECPKG_ATTR_CLIENT_SPECIFIED_TARGET 27
292 #define SECPKG_ATTR_LAST_CLIENT_TOKEN_STATUS 30
293 #define SECPKG_ATTR_NEGO_PKG_INFO 31
294 #define SECPKG_ATTR_NEGO_STATUS 32
295 #define SECPKG_ATTR_CONTEXT_DELETED 33
297 #if !defined(_WIN32) || defined(_UWP)
313 char* sAuthorityName;
321 typedef UINT32 ALG_ID;
327 UINT32 dwCipherStrength;
329 UINT32 dwHashStrength;
331 UINT32 dwExchStrength;
336 UINT32 AuthBufferLen;
348 UINT32 dwInitiatorAddrType;
349 UINT32 cbInitiatorLength;
350 UINT32 dwInitiatorOffset;
351 UINT32 dwAcceptorAddrType;
352 UINT32 cbAcceptorLength;
353 UINT32 dwAcceptorOffset;
354 UINT32 cbApplicationDataLength;
355 UINT32 dwApplicationDataOffset;
371 char* sSignatureAlgorithmName;
372 char* sEncryptAlgorithmName;
374 UINT32 SignatureAlgorithm;
375 UINT32 EncryptAlgorithm;
397 SecPkgInfo* PackageInfo;
398 UINT32 NegotiationState;
403 SecPkgInfo* PackageInfo;
413 UINT32 SessionKeyLength;
421 BYTE rgbSessionId[32];
427 UINT32 cbMaxSignature;
429 UINT32 cbSecurityTrailer;
436 UINT32 cbMaximumMessage;
448 UINT16 cSignatureAndHashAlgorithms;
449 UINT16* pSignatureAndHashAlgorithms;
454 UINT32 MarshalledTargetInfoLength;
455 BYTE* MarshalledTargetInfo;
460 #define SECPKG_CRED_ATTR_NAMES 1
461 #define SECPKG_CRED_ATTR_SSI_PROVIDER 2
462 #define SECPKG_CRED_ATTR_CERT 4
463 #define SECPKG_CRED_ATTR_PAC_BYPASS 5
473 SEC_WCHAR* sUserName;
478 #define SecPkgCredentials_Names SecPkgCredentials_NamesW
479 #define PSecPkgCredentials_Names PSecPkgCredentials_NamesW
481 #define SecPkgCredentials_Names SecPkgCredentials_NamesA
482 #define PSecPkgCredentials_Names PSecPkgCredentials_NamesA
487 SEC_WCHAR* sProviderName;
488 unsigned long ProviderInfoLength;
494 SEC_CHAR* sProviderName;
495 unsigned long ProviderInfoLength;
500 #define SecPkgCredentials_SSIProvider SecPkgCredentials_SSIProviderW
501 #define PSecPkgCredentials_SSIProvider PSecPkgCredentials_SSIProviderW
503 #define SecPkgCredentials_SSIProvider SecPkgCredentials_SSIProviderA
504 #define PSecPkgCredentials_SSIProvider PSecPkgCredentials_SSIProviderA
509 unsigned long EncodedCertSize;
510 unsigned char* EncodedCert;
515 #if !defined(_WIN32) || defined(_UWP) || (defined(__MINGW32__) && (__MINGW64_VERSION_MAJOR <= 8))
517 #define SECPKG_CRED_ATTR_KDC_PROXY_SETTINGS 3
519 #define KDC_PROXY_SETTINGS_V1 1
520 #define KDC_PROXY_SETTINGS_FLAGS_FORCEPROXY 0x1
526 USHORT ProxyServerOffset;
527 USHORT ProxyServerLength;
528 USHORT ClientTlsCredOffset;
529 USHORT ClientTlsCredLength;
536 USHORT ProxyServerOffset;
537 USHORT ProxyServerLength;
538 USHORT ClientTlsCredOffset;
539 USHORT ClientTlsCredLength;
543 #define SecPkgCredentials_KdcProxySettings SecPkgCredentials_KdcProxySettingsW
544 #define PSecPkgCredentials_KdcProxySettings PSecPkgCredentials_KdcProxySettingsW
546 #define SecPkgCredentials_KdcProxySettings SecPkgCredentials_KdcProxySettingsA
547 #define PSecPkgCredentials_KdcProxySettings SecPkgCredentials_KdcProxySettingsA
552 UINT32 BindingsLength;
559 #define ISC_REQ_DELEGATE 0x00000001
560 #define ISC_REQ_MUTUAL_AUTH 0x00000002
561 #define ISC_REQ_REPLAY_DETECT 0x00000004
562 #define ISC_REQ_SEQUENCE_DETECT 0x00000008
563 #define ISC_REQ_CONFIDENTIALITY 0x00000010
564 #define ISC_REQ_USE_SESSION_KEY 0x00000020
565 #define ISC_REQ_PROMPT_FOR_CREDS 0x00000040
566 #define ISC_REQ_USE_SUPPLIED_CREDS 0x00000080
567 #define ISC_REQ_ALLOCATE_MEMORY 0x00000100
568 #define ISC_REQ_USE_DCE_STYLE 0x00000200
569 #define ISC_REQ_DATAGRAM 0x00000400
570 #define ISC_REQ_CONNECTION 0x00000800
571 #define ISC_REQ_CALL_LEVEL 0x00001000
572 #define ISC_REQ_FRAGMENT_SUPPLIED 0x00002000
573 #define ISC_REQ_EXTENDED_ERROR 0x00004000
574 #define ISC_REQ_STREAM 0x00008000
575 #define ISC_REQ_INTEGRITY 0x00010000
576 #define ISC_REQ_IDENTIFY 0x00020000
577 #define ISC_REQ_NULL_SESSION 0x00040000
578 #define ISC_REQ_MANUAL_CRED_VALIDATION 0x00080000
579 #define ISC_REQ_RESERVED1 0x00100000
580 #define ISC_REQ_FRAGMENT_TO_FIT 0x00200000
581 #define ISC_REQ_FORWARD_CREDENTIALS 0x00400000
582 #define ISC_REQ_NO_INTEGRITY 0x00800000
583 #define ISC_REQ_USE_HTTP_STYLE 0x01000000
585 #define ISC_RET_DELEGATE 0x00000001
586 #define ISC_RET_MUTUAL_AUTH 0x00000002
587 #define ISC_RET_REPLAY_DETECT 0x00000004
588 #define ISC_RET_SEQUENCE_DETECT 0x00000008
589 #define ISC_RET_CONFIDENTIALITY 0x00000010
590 #define ISC_RET_USE_SESSION_KEY 0x00000020
591 #define ISC_RET_USED_COLLECTED_CREDS 0x00000040
592 #define ISC_RET_USED_SUPPLIED_CREDS 0x00000080
593 #define ISC_RET_ALLOCATED_MEMORY 0x00000100
594 #define ISC_RET_USED_DCE_STYLE 0x00000200
595 #define ISC_RET_DATAGRAM 0x00000400
596 #define ISC_RET_CONNECTION 0x00000800
597 #define ISC_RET_INTERMEDIATE_RETURN 0x00001000
598 #define ISC_RET_CALL_LEVEL 0x00002000
599 #define ISC_RET_EXTENDED_ERROR 0x00004000
600 #define ISC_RET_STREAM 0x00008000
601 #define ISC_RET_INTEGRITY 0x00010000
602 #define ISC_RET_IDENTIFY 0x00020000
603 #define ISC_RET_NULL_SESSION 0x00040000
604 #define ISC_RET_MANUAL_CRED_VALIDATION 0x00080000
605 #define ISC_RET_RESERVED1 0x00100000
606 #define ISC_RET_FRAGMENT_ONLY 0x00200000
607 #define ISC_RET_FORWARD_CREDENTIALS 0x00400000
608 #define ISC_RET_USED_HTTP_STYLE 0x01000000
612 #define ASC_REQ_DELEGATE 0x00000001
613 #define ASC_REQ_MUTUAL_AUTH 0x00000002
614 #define ASC_REQ_REPLAY_DETECT 0x00000004
615 #define ASC_REQ_SEQUENCE_DETECT 0x00000008
616 #define ASC_REQ_CONFIDENTIALITY 0x00000010
617 #define ASC_REQ_USE_SESSION_KEY 0x00000020
618 #define ASC_REQ_ALLOCATE_MEMORY 0x00000100
619 #define ASC_REQ_USE_DCE_STYLE 0x00000200
620 #define ASC_REQ_DATAGRAM 0x00000400
621 #define ASC_REQ_CONNECTION 0x00000800
622 #define ASC_REQ_CALL_LEVEL 0x00001000
623 #define ASC_REQ_EXTENDED_ERROR 0x00008000
624 #define ASC_REQ_STREAM 0x00010000
625 #define ASC_REQ_INTEGRITY 0x00020000
626 #define ASC_REQ_LICENSING 0x00040000
627 #define ASC_REQ_IDENTIFY 0x00080000
628 #define ASC_REQ_ALLOW_NULL_SESSION 0x00100000
629 #define ASC_REQ_ALLOW_NON_USER_LOGONS 0x00200000
630 #define ASC_REQ_ALLOW_CONTEXT_REPLAY 0x00400000
631 #define ASC_REQ_FRAGMENT_TO_FIT 0x00800000
632 #define ASC_REQ_FRAGMENT_SUPPLIED 0x00002000
633 #define ASC_REQ_NO_TOKEN 0x01000000
634 #define ASC_REQ_PROXY_BINDINGS 0x04000000
635 #define ASC_REQ_ALLOW_MISSING_BINDINGS 0x10000000
637 #define ASC_RET_DELEGATE 0x00000001
638 #define ASC_RET_MUTUAL_AUTH 0x00000002
639 #define ASC_RET_REPLAY_DETECT 0x00000004
640 #define ASC_RET_SEQUENCE_DETECT 0x00000008
641 #define ASC_RET_CONFIDENTIALITY 0x00000010
642 #define ASC_RET_USE_SESSION_KEY 0x00000020
643 #define ASC_RET_ALLOCATED_MEMORY 0x00000100
644 #define ASC_RET_USED_DCE_STYLE 0x00000200
645 #define ASC_RET_DATAGRAM 0x00000400
646 #define ASC_RET_CONNECTION 0x00000800
647 #define ASC_RET_CALL_LEVEL 0x00002000
648 #define ASC_RET_THIRD_LEG_FAILED 0x00004000
649 #define ASC_RET_EXTENDED_ERROR 0x00008000
650 #define ASC_RET_STREAM 0x00010000
651 #define ASC_RET_INTEGRITY 0x00020000
652 #define ASC_RET_LICENSING 0x00040000
653 #define ASC_RET_IDENTIFY 0x00080000
654 #define ASC_RET_NULL_SESSION 0x00100000
655 #define ASC_RET_ALLOW_NON_USER_LOGONS 0x00200000
656 #define ASC_RET_FRAGMENT_ONLY 0x00800000
657 #define ASC_RET_NO_TOKEN 0x01000000
658 #define ASC_RET_NO_PROXY_BINDINGS 0x04000000
659 #define ASC_RET_MISSING_BINDINGS 0x10000000
661 #define SEC_WINNT_AUTH_IDENTITY_ANSI 0x1
662 #define SEC_WINNT_AUTH_IDENTITY_UNICODE 0x2
663 #define SEC_WINNT_AUTH_IDENTITY_MARSHALLED 0x4
664 #define SEC_WINNT_AUTH_IDENTITY_ONLY 0x8
665 #define SEC_WINNT_AUTH_IDENTITY_EXTENDED 0x100
667 #if !defined(_WIN32) || defined(_UWP) || defined(__MINGW32__)
669 WINPR_PRAGMA_DIAG_PUSH
670 WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO
672 #ifndef _AUTH_IDENTITY_DEFINED
673 #define _AUTH_IDENTITY_DEFINED
682 ULONG PasswordLength;
693 ULONG PasswordLength;
700 #define SEC_WINNT_AUTH_IDENTITY SEC_WINNT_AUTH_IDENTITY_W
701 #define PSEC_WINNT_AUTH_IDENTITY PSEC_WINNT_AUTH_IDENTITY_W
703 #define SEC_WINNT_AUTH_IDENTITY SEC_WINNT_AUTH_IDENTITY_W
704 #define PSEC_WINNT_AUTH_IDENTITY PSEC_WINNT_AUTH_IDENTITY_W
709 #ifndef SEC_WINNT_AUTH_IDENTITY_VERSION
710 #define SEC_WINNT_AUTH_IDENTITY_VERSION 0x200
721 UINT32 PasswordLength;
724 UINT32 PackageListLength;
736 UINT32 PasswordLength;
739 UINT32 PackageListLength;
743 #define SEC_WINNT_AUTH_IDENTITY_EX SEC_WINNT_AUTH_IDENTITY_EXW
744 #define PSEC_WINNT_AUTH_IDENTITY_EX PSEC_WINNT_AUTH_IDENTITY_EXW
746 #define SEC_WINNT_AUTH_IDENTITY_EX SEC_WINNT_AUTH_IDENTITY_EXA
747 #define PSEC_WINNT_AUTH_IDENTITY_EX PSEC_WINNT_AUTH_IDENTITY_EXA
752 #ifndef SEC_WINNT_AUTH_IDENTITY_VERSION_2
753 #define SEC_WINNT_AUTH_IDENTITY_VERSION_2 0x201
758 UINT16 cbHeaderLength;
759 UINT32 cbStructureLength;
764 UINT32 PackedCredentialsOffset;
765 UINT16 PackedCredentialsLength;
767 UINT32 PackageListOffset;
768 UINT16 PackageListLength;
773 #ifndef _AUTH_IDENTITY_INFO_DEFINED
774 #define _AUTH_IDENTITY_INFO_DEFINED
787 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_PROCESS_ENCRYPTED 0x10
788 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_SYSTEM_PROTECTED 0x20
789 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_USER_PROTECTED 0x40
790 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_SYSTEM_ENCRYPTED 0x80
791 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_RESERVED 0x10000
792 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_NULL_USER 0x20000
793 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_NULL_DOMAIN 0x40000
794 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_ID_PROVIDER 0x80000
796 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_USE_MASK 0xFF000000
797 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_CREDPROV_DO_NOT_SAVE 0x80000000
798 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_SAVE_CRED_CHECKED 0x40000000
799 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_NO_CHECKBOX 0x20000000
800 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_CREDPROV_DO_NOT_LOAD 0x10000000
802 #define SEC_WINNT_AUTH_IDENTITY_FLAGS_VALID_SSPIPFC_FLAGS \
803 (SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_CREDPROV_DO_NOT_SAVE | \
804 SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_SAVE_CRED_CHECKED | \
805 SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_NO_CHECKBOX | \
806 SEC_WINNT_AUTH_IDENTITY_FLAGS_SSPIPFC_CREDPROV_DO_NOT_LOAD)
810 WINPR_PRAGMA_DIAG_POP
812 #if !defined(__MINGW32__)
825 #define SecInvalidateHandle(x) \
826 ((PSecHandle)(x))->dwLower = ((PSecHandle)(x))->dwUpper = ((ULONG_PTR)((INT_PTR)-1))
828 #define SecIsValidHandle(x) \
829 ((((PSecHandle)(x))->dwLower != ((ULONG_PTR)((INT_PTR)-1))) && \
830 (((PSecHandle)(x))->dwUpper != ((ULONG_PTR)((INT_PTR)-1))))
852 typedef SECURITY_STATUS (*psSspiNtlmHashCallback)(
void* client,
853 const SEC_WINNT_AUTH_IDENTITY* authIdentity,
855 const BYTE* randkey,
const BYTE* mic,
856 const SecBuffer* micvalue, BYTE* ntlmhash);
861 psSspiNtlmHashCallback hashCallback;
862 void* hashCallbackArg;
871 char* pkinitX509Anchors;
872 char* pkinitX509Identity;
887 #define SECBUFFER_VERSION 0
890 #define SECBUFFER_EMPTY 0
891 #define SECBUFFER_DATA 1
892 #define SECBUFFER_TOKEN 2
893 #define SECBUFFER_PKG_PARAMS 3
894 #define SECBUFFER_MISSING 4
895 #define SECBUFFER_EXTRA 5
896 #define SECBUFFER_STREAM_TRAILER 6
897 #define SECBUFFER_STREAM_HEADER 7
898 #define SECBUFFER_NEGOTIATION_INFO 8
899 #define SECBUFFER_PADDING 9
900 #define SECBUFFER_STREAM 10
901 #define SECBUFFER_MECHLIST 11
902 #define SECBUFFER_MECHLIST_SIGNATURE 12
903 #define SECBUFFER_TARGET 13
904 #define SECBUFFER_CHANNEL_BINDINGS 14
905 #define SECBUFFER_CHANGE_PASS_RESPONSE 15
906 #define SECBUFFER_TARGET_HOST 16
907 #define SECBUFFER_ALERT 17
910 #define SECBUFFER_ATTRMASK 0xF0000000
911 #define SECBUFFER_READONLY 0x80000000
912 #define SECBUFFER_READONLY_WITH_CHECKSUM 0x10000000
913 #define SECBUFFER_RESERVED 0x60000000
915 #if !defined(_WIN32) || defined(_UWP)
917 typedef void(SEC_ENTRY* SEC_GET_KEY_FN)(
void* Arg,
void* Principal, UINT32 KeyVer,
void** Key,
918 SECURITY_STATUS* pStatus);
920 typedef SECURITY_STATUS(SEC_ENTRY* ENUMERATE_SECURITY_PACKAGES_FN_A)(ULONG* pcPackages,
922 typedef SECURITY_STATUS(SEC_ENTRY* ENUMERATE_SECURITY_PACKAGES_FN_W)(ULONG* pcPackages,
926 #define EnumerateSecurityPackages EnumerateSecurityPackagesW
927 #define ENUMERATE_SECURITY_PACKAGES_FN ENUMERATE_SECURITY_PACKAGES_FN_W
929 #define EnumerateSecurityPackages EnumerateSecurityPackagesA
930 #define ENUMERATE_SECURITY_PACKAGES_FN ENUMERATE_SECURITY_PACKAGES_FN_A
933 typedef SECURITY_STATUS(SEC_ENTRY* QUERY_CREDENTIALS_ATTRIBUTES_FN_A)(
PCredHandle phCredential,
936 typedef SECURITY_STATUS(SEC_ENTRY* QUERY_CREDENTIALS_ATTRIBUTES_FN_W)(
PCredHandle phCredential,
941 #define QueryCredentialsAttributes QueryCredentialsAttributesW
942 #define QUERY_CREDENTIALS_ATTRIBUTES_FN QUERY_CREDENTIALS_ATTRIBUTES_FN_W
944 #define QueryCredentialsAttributes QueryCredentialsAttributesA
945 #define QUERY_CREDENTIALS_ATTRIBUTES_FN QUERY_CREDENTIALS_ATTRIBUTES_FN_A
948 typedef SECURITY_STATUS(SEC_ENTRY* ACQUIRE_CREDENTIALS_HANDLE_FN_A)(
949 LPSTR pszPrincipal, LPSTR pszPackage, ULONG fCredentialUse,
void* pvLogonID,
void* pAuthData,
950 SEC_GET_KEY_FN pGetKeyFn,
void* pvGetKeyArgument,
PCredHandle phCredential,
952 typedef SECURITY_STATUS(SEC_ENTRY* ACQUIRE_CREDENTIALS_HANDLE_FN_W)(
953 LPWSTR pszPrincipal, LPWSTR pszPackage, ULONG fCredentialUse,
void* pvLogonID,
void* pAuthData,
954 SEC_GET_KEY_FN pGetKeyFn,
void* pvGetKeyArgument,
PCredHandle phCredential,
958 #define AcquireCredentialsHandle AcquireCredentialsHandleW
959 #define ACQUIRE_CREDENTIALS_HANDLE_FN ACQUIRE_CREDENTIALS_HANDLE_FN_W
961 #define AcquireCredentialsHandle AcquireCredentialsHandleA
962 #define ACQUIRE_CREDENTIALS_HANDLE_FN ACQUIRE_CREDENTIALS_HANDLE_FN_A
965 typedef SECURITY_STATUS(SEC_ENTRY* FREE_CREDENTIALS_HANDLE_FN)(
PCredHandle phCredential);
967 typedef SECURITY_STATUS(SEC_ENTRY* INITIALIZE_SECURITY_CONTEXT_FN_A)(
969 ULONG Reserved1, ULONG TargetDataRep,
PSecBufferDesc pInput, ULONG Reserved2,
971 typedef SECURITY_STATUS(SEC_ENTRY* INITIALIZE_SECURITY_CONTEXT_FN_W)(
973 ULONG Reserved1, ULONG TargetDataRep,
PSecBufferDesc pInput, ULONG Reserved2,
977 #define InitializeSecurityContext InitializeSecurityContextW
978 #define INITIALIZE_SECURITY_CONTEXT_FN INITIALIZE_SECURITY_CONTEXT_FN_W
980 #define InitializeSecurityContext InitializeSecurityContextA
981 #define INITIALIZE_SECURITY_CONTEXT_FN INITIALIZE_SECURITY_CONTEXT_FN_A
984 typedef SECURITY_STATUS(SEC_ENTRY* ACCEPT_SECURITY_CONTEXT_FN)(
989 typedef SECURITY_STATUS(SEC_ENTRY* COMPLETE_AUTH_TOKEN_FN)(
PCtxtHandle phContext,
992 typedef SECURITY_STATUS(SEC_ENTRY* DELETE_SECURITY_CONTEXT_FN)(
PCtxtHandle phContext);
994 typedef SECURITY_STATUS(SEC_ENTRY* APPLY_CONTROL_TOKEN_FN)(
PCtxtHandle phContext,
997 typedef SECURITY_STATUS(SEC_ENTRY* QUERY_CONTEXT_ATTRIBUTES_FN_A)(
PCtxtHandle phContext,
998 ULONG ulAttribute,
void* pBuffer);
999 typedef SECURITY_STATUS(SEC_ENTRY* QUERY_CONTEXT_ATTRIBUTES_FN_W)(
PCtxtHandle phContext,
1000 ULONG ulAttribute,
void* pBuffer);
1003 #define QueryContextAttributes QueryContextAttributesW
1004 #define QUERY_CONTEXT_ATTRIBUTES_FN QUERY_CONTEXT_ATTRIBUTES_FN_W
1006 #define QueryContextAttributes QueryContextAttributesA
1007 #define QUERY_CONTEXT_ATTRIBUTES_FN QUERY_CONTEXT_ATTRIBUTES_FN_A
1010 typedef SECURITY_STATUS(SEC_ENTRY* IMPERSONATE_SECURITY_CONTEXT_FN)(
PCtxtHandle phContext);
1012 typedef SECURITY_STATUS(SEC_ENTRY* REVERT_SECURITY_CONTEXT_FN)(
PCtxtHandle phContext);
1014 typedef SECURITY_STATUS(SEC_ENTRY* MAKE_SIGNATURE_FN)(
PCtxtHandle phContext, ULONG fQOP,
1017 typedef SECURITY_STATUS(SEC_ENTRY* VERIFY_SIGNATURE_FN)(
PCtxtHandle phContext,
1021 typedef SECURITY_STATUS(SEC_ENTRY* FREE_CONTEXT_BUFFER_FN)(
void* pvContextBuffer);
1023 typedef SECURITY_STATUS(SEC_ENTRY* QUERY_SECURITY_PACKAGE_INFO_FN_A)(SEC_CHAR* pszPackageName,
1025 typedef SECURITY_STATUS(SEC_ENTRY* QUERY_SECURITY_PACKAGE_INFO_FN_W)(SEC_WCHAR* pszPackageName,
1029 #define QuerySecurityPackageInfo QuerySecurityPackageInfoW
1030 #define QUERY_SECURITY_PACKAGE_INFO_FN QUERY_SECURITY_PACKAGE_INFO_FN_W
1032 #define QuerySecurityPackageInfo QuerySecurityPackageInfoA
1033 #define QUERY_SECURITY_PACKAGE_INFO_FN QUERY_SECURITY_PACKAGE_INFO_FN_A
1036 typedef SECURITY_STATUS(SEC_ENTRY* EXPORT_SECURITY_CONTEXT_FN)(
PCtxtHandle phContext, ULONG fFlags,
1040 typedef SECURITY_STATUS(SEC_ENTRY* IMPORT_SECURITY_CONTEXT_FN_A)(SEC_CHAR* pszPackage,
1044 typedef SECURITY_STATUS(SEC_ENTRY* IMPORT_SECURITY_CONTEXT_FN_W)(SEC_WCHAR* pszPackage,
1050 #define ImportSecurityContext ImportSecurityContextW
1051 #define IMPORT_SECURITY_CONTEXT_FN IMPORT_SECURITY_CONTEXT_FN_W
1053 #define ImportSecurityContext ImportSecurityContextA
1054 #define IMPORT_SECURITY_CONTEXT_FN IMPORT_SECURITY_CONTEXT_FN_A
1057 typedef SECURITY_STATUS(SEC_ENTRY* ADD_CREDENTIALS_FN_A)(
1058 PCredHandle hCredentials, SEC_CHAR* pszPrincipal, SEC_CHAR* pszPackage, UINT32 fCredentialUse,
1059 void* pAuthData, SEC_GET_KEY_FN pGetKeyFn,
void* pvGetKeyArgument,
PTimeStamp ptsExpiry);
1060 typedef SECURITY_STATUS(SEC_ENTRY* ADD_CREDENTIALS_FN_W)(
1061 PCredHandle hCredentials, SEC_WCHAR* pszPrincipal, SEC_WCHAR* pszPackage, UINT32 fCredentialUse,
1062 void* pAuthData, SEC_GET_KEY_FN pGetKeyFn,
void* pvGetKeyArgument,
PTimeStamp ptsExpiry);
1065 #define AddCredentials AddCredentialsW
1066 #define ADD_CREDENTIALS_FN ADD_CREDENTIALS_FN_W
1068 #define AddCredentials AddCredentialsA
1069 #define ADD_CREDENTIALS_FN ADD_CREDENTIALS_FN_A
1072 typedef SECURITY_STATUS(SEC_ENTRY* QUERY_SECURITY_CONTEXT_TOKEN_FN)(
PCtxtHandle phContext,
1075 typedef SECURITY_STATUS(SEC_ENTRY* ENCRYPT_MESSAGE_FN)(
PCtxtHandle phContext, ULONG fQOP,
1078 typedef SECURITY_STATUS(SEC_ENTRY* DECRYPT_MESSAGE_FN)(
PCtxtHandle phContext,
1082 typedef SECURITY_STATUS(SEC_ENTRY* SET_CONTEXT_ATTRIBUTES_FN_A)(
PCtxtHandle phContext,
1083 ULONG ulAttribute,
void* pBuffer,
1085 typedef SECURITY_STATUS(SEC_ENTRY* SET_CONTEXT_ATTRIBUTES_FN_W)(
PCtxtHandle phContext,
1086 ULONG ulAttribute,
void* pBuffer,
1090 #define SetContextAttributes SetContextAttributesW
1091 #define SET_CONTEXT_ATTRIBUTES_FN SET_CONTEXT_ATTRIBUTES_FN_W
1093 #define SetContextAttributes SetContextAttributesA
1094 #define SET_CONTEXT_ATTRIBUTES_FN SET_CONTEXT_ATTRIBUTES_FN_A
1097 typedef SECURITY_STATUS(SEC_ENTRY* SET_CREDENTIALS_ATTRIBUTES_FN_A)(
PCredHandle phCredential,
1099 void* pBuffer, ULONG cbBuffer);
1101 typedef SECURITY_STATUS(SEC_ENTRY* SET_CREDENTIALS_ATTRIBUTES_FN_W)(
PCredHandle phCredential,
1103 void* pBuffer, ULONG cbBuffer);
1106 #define SetCredentialsAttributes SetCredentialsAttributesW
1107 #define SET_CREDENTIALS_ATTRIBUTES_FN SET_CREDENTIALS_ATTRIBUTES_FN_W
1109 #define SetCredentialsAttributes SetCredentialsAttributesA
1110 #define SET_CREDENTIALS_ATTRIBUTES_FN SET_CREDENTIALS_ATTRIBUTES_FN_A
1113 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION \
1115 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_2 \
1117 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_3 \
1119 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_4 \
1125 ENUMERATE_SECURITY_PACKAGES_FN_A EnumerateSecurityPackagesA;
1126 QUERY_CREDENTIALS_ATTRIBUTES_FN_A QueryCredentialsAttributesA;
1127 ACQUIRE_CREDENTIALS_HANDLE_FN_A AcquireCredentialsHandleA;
1128 FREE_CREDENTIALS_HANDLE_FN FreeCredentialsHandle;
1130 INITIALIZE_SECURITY_CONTEXT_FN_A InitializeSecurityContextA;
1131 ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext;
1132 COMPLETE_AUTH_TOKEN_FN CompleteAuthToken;
1133 DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext;
1134 APPLY_CONTROL_TOKEN_FN ApplyControlToken;
1135 QUERY_CONTEXT_ATTRIBUTES_FN_A QueryContextAttributesA;
1136 IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext;
1137 REVERT_SECURITY_CONTEXT_FN RevertSecurityContext;
1138 MAKE_SIGNATURE_FN MakeSignature;
1139 VERIFY_SIGNATURE_FN VerifySignature;
1140 FREE_CONTEXT_BUFFER_FN FreeContextBuffer;
1141 QUERY_SECURITY_PACKAGE_INFO_FN_A QuerySecurityPackageInfoA;
1144 EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext;
1145 IMPORT_SECURITY_CONTEXT_FN_A ImportSecurityContextA;
1146 ADD_CREDENTIALS_FN_A AddCredentialsA;
1148 QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken;
1149 ENCRYPT_MESSAGE_FN EncryptMessage;
1150 DECRYPT_MESSAGE_FN DecryptMessage;
1151 SET_CONTEXT_ATTRIBUTES_FN_A SetContextAttributesA;
1152 SET_CREDENTIALS_ATTRIBUTES_FN_A SetCredentialsAttributesA;
1159 ENUMERATE_SECURITY_PACKAGES_FN_W EnumerateSecurityPackagesW;
1160 QUERY_CREDENTIALS_ATTRIBUTES_FN_W QueryCredentialsAttributesW;
1161 ACQUIRE_CREDENTIALS_HANDLE_FN_W AcquireCredentialsHandleW;
1162 FREE_CREDENTIALS_HANDLE_FN FreeCredentialsHandle;
1164 INITIALIZE_SECURITY_CONTEXT_FN_W InitializeSecurityContextW;
1165 ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext;
1166 COMPLETE_AUTH_TOKEN_FN CompleteAuthToken;
1167 DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext;
1168 APPLY_CONTROL_TOKEN_FN ApplyControlToken;
1169 QUERY_CONTEXT_ATTRIBUTES_FN_W QueryContextAttributesW;
1170 IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext;
1171 REVERT_SECURITY_CONTEXT_FN RevertSecurityContext;
1172 MAKE_SIGNATURE_FN MakeSignature;
1173 VERIFY_SIGNATURE_FN VerifySignature;
1174 FREE_CONTEXT_BUFFER_FN FreeContextBuffer;
1175 QUERY_SECURITY_PACKAGE_INFO_FN_W QuerySecurityPackageInfoW;
1178 EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext;
1179 IMPORT_SECURITY_CONTEXT_FN_W ImportSecurityContextW;
1180 ADD_CREDENTIALS_FN_W AddCredentialsW;
1182 QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken;
1183 ENCRYPT_MESSAGE_FN EncryptMessage;
1184 DECRYPT_MESSAGE_FN DecryptMessage;
1185 SET_CONTEXT_ATTRIBUTES_FN_W SetContextAttributesW;
1186 SET_CREDENTIALS_ATTRIBUTES_FN_W SetCredentialsAttributesW;
1194 #define InitSecurityInterface InitSecurityInterfaceW
1195 #define SecurityFunctionTable SecurityFunctionTableW
1196 #define PSecurityFunctionTable PSecurityFunctionTableW
1197 #define INIT_SECURITY_INTERFACE INIT_SECURITY_INTERFACE_W
1199 #define InitSecurityInterface InitSecurityInterfaceA
1200 #define SecurityFunctionTable SecurityFunctionTableA
1201 #define PSecurityFunctionTable PSecurityFunctionTableA
1202 #define INIT_SECURITY_INTERFACE INIT_SECURITY_INTERFACE_A
1214 WINPR_API SECURITY_STATUS SEC_ENTRY EnumerateSecurityPackagesA(ULONG* pcPackages,
1216 WINPR_API SECURITY_STATUS SEC_ENTRY EnumerateSecurityPackagesW(ULONG* pcPackages,
1222 WINPR_API SECURITY_STATUS SEC_ENTRY QuerySecurityPackageInfoA(SEC_CHAR* pszPackageName,
1224 WINPR_API SECURITY_STATUS SEC_ENTRY QuerySecurityPackageInfoW(SEC_WCHAR* pszPackageName,
1229 WINPR_API SECURITY_STATUS SEC_ENTRY AcquireCredentialsHandleA(
1230 SEC_CHAR* pszPrincipal, SEC_CHAR* pszPackage, ULONG fCredentialUse,
void* pvLogonID,
1231 void* pAuthData, SEC_GET_KEY_FN pGetKeyFn,
void* pvGetKeyArgument,
PCredHandle phCredential,
1233 WINPR_API SECURITY_STATUS SEC_ENTRY AcquireCredentialsHandleW(
1234 SEC_WCHAR* pszPrincipal, SEC_WCHAR* pszPackage, ULONG fCredentialUse,
void* pvLogonID,
1235 void* pAuthData, SEC_GET_KEY_FN pGetKeyFn,
void* pvGetKeyArgument,
PCredHandle phCredential,
1238 WINPR_API SECURITY_STATUS SEC_ENTRY ExportSecurityContext(
PCtxtHandle phContext, ULONG fFlags,
1241 WINPR_API SECURITY_STATUS SEC_ENTRY FreeCredentialsHandle(
PCredHandle phCredential);
1243 WINPR_API SECURITY_STATUS SEC_ENTRY ImportSecurityContextA(SEC_CHAR* pszPackage,
1247 WINPR_API SECURITY_STATUS SEC_ENTRY ImportSecurityContextW(SEC_WCHAR* pszPackage,
1252 WINPR_API SECURITY_STATUS SEC_ENTRY QueryCredentialsAttributesA(
PCredHandle phCredential,
1255 WINPR_API SECURITY_STATUS SEC_ENTRY QueryCredentialsAttributesW(
PCredHandle phCredential,
1261 WINPR_API SECURITY_STATUS SEC_ENTRY
1263 ULONG fContextReq, ULONG TargetDataRep,
PCtxtHandle phNewContext,
1266 WINPR_API SECURITY_STATUS SEC_ENTRY ApplyControlToken(
PCtxtHandle phContext,
1268 WINPR_API SECURITY_STATUS SEC_ENTRY CompleteAuthToken(
PCtxtHandle phContext,
1270 WINPR_API SECURITY_STATUS SEC_ENTRY DeleteSecurityContext(
PCtxtHandle phContext);
1271 WINPR_API SECURITY_STATUS SEC_ENTRY FreeContextBuffer(
void* pvContextBuffer);
1272 WINPR_API SECURITY_STATUS SEC_ENTRY ImpersonateSecurityContext(
PCtxtHandle phContext);
1274 WINPR_API SECURITY_STATUS SEC_ENTRY InitializeSecurityContextA(
1276 ULONG Reserved1, ULONG TargetDataRep,
PSecBufferDesc pInput, ULONG Reserved2,
1279 WINPR_API SECURITY_STATUS SEC_ENTRY InitializeSecurityContextW(
1281 ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep,
PSecBufferDesc pInput,
1285 WINPR_API SECURITY_STATUS SEC_ENTRY QueryContextAttributes(
PCtxtHandle phContext,
1286 ULONG ulAttribute,
void* pBuffer);
1287 WINPR_API SECURITY_STATUS SEC_ENTRY QuerySecurityContextToken(
PCtxtHandle phContext,
1289 WINPR_API SECURITY_STATUS SEC_ENTRY SetContextAttributes(
PCtxtHandle phContext,
1290 ULONG ulAttribute,
void* pBuffer,
1292 WINPR_API SECURITY_STATUS SEC_ENTRY RevertSecurityContext(
PCtxtHandle phContext);
1296 WINPR_API SECURITY_STATUS SEC_ENTRY DecryptMessage(
PCtxtHandle phContext,
1299 WINPR_API SECURITY_STATUS SEC_ENTRY EncryptMessage(
PCtxtHandle phContext, ULONG fQOP,
1301 WINPR_API SECURITY_STATUS SEC_ENTRY MakeSignature(
PCtxtHandle phContext, ULONG fQOP,
1303 WINPR_API SECURITY_STATUS SEC_ENTRY VerifySignature(
PCtxtHandle phContext,
1323 #define SECPKG_ATTR_AUTH_IDENTITY 1001
1324 #define SECPKG_ATTR_AUTH_PASSWORD 1002
1325 #define SECPKG_ATTR_AUTH_NTLM_HASH 1003
1326 #define SECPKG_ATTR_AUTH_NTLM_MESSAGE 1100
1327 #define SECPKG_ATTR_AUTH_NTLM_TIMESTAMP 1101
1328 #define SECPKG_ATTR_AUTH_NTLM_CLIENT_CHALLENGE 1102
1329 #define SECPKG_ATTR_AUTH_NTLM_SERVER_CHALLENGE 1103
1330 #define SECPKG_ATTR_AUTH_NTLM_NTPROOF_VALUE 1104
1331 #define SECPKG_ATTR_AUTH_NTLM_RANDKEY 1105
1332 #define SECPKG_ATTR_AUTH_NTLM_MIC 1106
1333 #define SECPKG_ATTR_AUTH_NTLM_MIC_VALUE 1107
1335 #define SECPKG_CRED_ATTR_TICKET_LOGON 1200
1340 char Domain[256 + 1];
1345 char Password[256 + 1];
1357 BOOL ChallengeOrResponse;
1362 BYTE ClientChallenge[8];
1367 BYTE ServerChallenge[8];
1377 #define SSPI_INTERFACE_WINPR 0x00000001
1378 #define SSPI_INTERFACE_NATIVE 0x00000002
1383 WINPR_API
void sspi_GlobalInit(
void);
1384 WINPR_API
void sspi_GlobalFinish(
void);
1389 #define sspi_SetAuthIdentity sspi_SetAuthIdentityA
1390 WINPR_API
int sspi_SetAuthIdentityA(SEC_WINNT_AUTH_IDENTITY* identity,
const char* user,
1391 const char* domain,
const char* password);
1392 WINPR_API
int sspi_SetAuthIdentityW(SEC_WINNT_AUTH_IDENTITY* identity,
const WCHAR* user,
1393 const WCHAR* domain,
const WCHAR* password);
1394 WINPR_API
int sspi_SetAuthIdentityWithLengthW(SEC_WINNT_AUTH_IDENTITY* identity,
1395 const WCHAR* user,
size_t userLen,
1396 const WCHAR* domain,
size_t domainLen,
1397 const WCHAR* password,
size_t passwordLen);
1398 WINPR_API UINT32 sspi_GetAuthIdentityVersion(
const void* identity);
1399 WINPR_API UINT32 sspi_GetAuthIdentityFlags(
const void* identity);
1400 WINPR_API BOOL sspi_GetAuthIdentityUserDomainW(
const void* identity,
const WCHAR** pUser,
1401 UINT32* pUserLength,
const WCHAR** pDomain,
1402 UINT32* pDomainLength);
1403 WINPR_API BOOL sspi_GetAuthIdentityUserDomainA(
const void* identity,
const char** pUser,
1404 UINT32* pUserLength,
const char** pDomain,
1405 UINT32* pDomainLength);
1406 WINPR_API BOOL sspi_GetAuthIdentityPasswordW(
const void* identity,
const WCHAR** pPassword,
1407 UINT32* pPasswordLength);
1408 WINPR_API BOOL sspi_GetAuthIdentityPasswordA(
const void* identity,
const char** pPassword,
1409 UINT32* pPasswordLength);
1411 char** pUser,
char** pDomain,
char** pPassword);
1413 WCHAR** pUser, WCHAR** pDomain, WCHAR** pPassword);
1415 char** pPackageList);
1416 WINPR_API
int sspi_CopyAuthIdentity(SEC_WINNT_AUTH_IDENTITY* identity,
1419 WINPR_API
void sspi_FreeAuthIdentity(SEC_WINNT_AUTH_IDENTITY* identity);
1421 WINPR_API
const char* GetSecurityStatusString(SECURITY_STATUS status);
1427 #define InitSecurityInterfaceEx InitSecurityInterfaceExW
1428 #define INIT_SECURITY_INTERFACE_EX INIT_SECURITY_INTERFACE_EX_W
1430 #define InitSecurityInterfaceEx InitSecurityInterfaceExA
1431 #define INIT_SECURITY_INTERFACE_EX INIT_SECURITY_INTERFACE_EX_A