Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

703 lines
20 KiB

  1. //+-----------------------------------------------------------------------
  2. //
  3. // Copyright (c) 1990-1999 Microsoft Corporation
  4. //
  5. // File: KERBEROS.H
  6. //
  7. // Contents: Public Kerberos Security Package structures for use
  8. // with APIs from SECURITY.H
  9. //
  10. //
  11. // History: 26 Feb 92, RichardW Compiled from other files
  12. //
  13. //------------------------------------------------------------------------
  14. #ifndef __KERBEROS_H__
  15. #define __KERBEROS_H__
  16. #if _MSC_VER > 1000
  17. #pragma once
  18. #endif
  19. #include <ntmsv1_0.h>
  20. #include <kerbcon.h>
  21. // begin_ntsecapi
  22. #ifndef MICROSOFT_KERBEROS_NAME_A
  23. #define MICROSOFT_KERBEROS_NAME_A "Kerberos"
  24. #define MICROSOFT_KERBEROS_NAME_W L"Kerberos"
  25. #ifdef WIN32_CHICAGO
  26. #define MICROSOFT_KERBEROS_NAME MICROSOFT_KERBEROS_NAME_A
  27. #else
  28. #define MICROSOFT_KERBEROS_NAME MICROSOFT_KERBEROS_NAME_W
  29. #endif // WIN32_CHICAGO
  30. #endif // MICROSOFT_KERBEROS_NAME_A
  31. // end_ntsecapi
  32. typedef struct _KERB_INIT_CONTEXT_DATA {
  33. LARGE_INTEGER StartTime; // Start time
  34. LARGE_INTEGER EndTime; // End time
  35. LARGE_INTEGER RenewUntilTime; // Renew until time
  36. ULONG TicketOptions; // From krb5.h
  37. ULONG RequestOptions; // Options on what to return
  38. } KERB_INIT_CONTEXT_DATA, *PKERB_INIT_CONTEXT_DATA;
  39. #define KERB_INIT_RETURN_TICKET 0x1 // return raw ticket
  40. #define KERB_INIT_RETURN_MIT_AP_REQ 0x2 // return MIT style AP request
  41. // begin_ntsecapi
  42. /////////////////////////////////////////////////////////////////////////
  43. //
  44. // Quality of protection parameters for MakeSignature / EncryptMessage
  45. //
  46. /////////////////////////////////////////////////////////////////////////
  47. //
  48. // This flag indicates to EncryptMessage that the message is not to actually
  49. // be encrypted, but a header/trailer are to be produced.
  50. //
  51. #define KERB_WRAP_NO_ENCRYPT 0x80000001
  52. /////////////////////////////////////////////////////////////////////////
  53. //
  54. // LsaLogonUser parameters
  55. //
  56. /////////////////////////////////////////////////////////////////////////
  57. typedef enum _KERB_LOGON_SUBMIT_TYPE {
  58. KerbInteractiveLogon = 2,
  59. KerbSmartCardLogon = 6,
  60. KerbWorkstationUnlockLogon = 7,
  61. KerbSmartCardUnlockLogon = 8,
  62. KerbProxyLogon = 9,
  63. KerbTicketLogon = 10,
  64. KerbTicketUnlockLogon = 11,
  65. KerbS4ULogon = 12
  66. } KERB_LOGON_SUBMIT_TYPE, *PKERB_LOGON_SUBMIT_TYPE;
  67. typedef struct _KERB_INTERACTIVE_LOGON {
  68. KERB_LOGON_SUBMIT_TYPE MessageType;
  69. UNICODE_STRING LogonDomainName;
  70. UNICODE_STRING UserName;
  71. UNICODE_STRING Password;
  72. } KERB_INTERACTIVE_LOGON, *PKERB_INTERACTIVE_LOGON;
  73. typedef struct _KERB_INTERACTIVE_UNLOCK_LOGON {
  74. KERB_INTERACTIVE_LOGON Logon;
  75. LUID LogonId;
  76. } KERB_INTERACTIVE_UNLOCK_LOGON, *PKERB_INTERACTIVE_UNLOCK_LOGON;
  77. typedef struct _KERB_SMART_CARD_LOGON {
  78. KERB_LOGON_SUBMIT_TYPE MessageType;
  79. UNICODE_STRING Pin;
  80. ULONG CspDataLength;
  81. PUCHAR CspData;
  82. } KERB_SMART_CARD_LOGON, *PKERB_SMART_CARD_LOGON;
  83. typedef struct _KERB_SMART_CARD_UNLOCK_LOGON {
  84. KERB_SMART_CARD_LOGON Logon;
  85. LUID LogonId;
  86. } KERB_SMART_CARD_UNLOCK_LOGON, *PKERB_SMART_CARD_UNLOCK_LOGON;
  87. //
  88. // Structure used for a ticket-only logon
  89. //
  90. typedef struct _KERB_TICKET_LOGON {
  91. KERB_LOGON_SUBMIT_TYPE MessageType;
  92. ULONG Flags;
  93. ULONG ServiceTicketLength;
  94. ULONG TicketGrantingTicketLength;
  95. PUCHAR ServiceTicket; // REQUIRED: Service ticket "host"
  96. PUCHAR TicketGrantingTicket; // OPTIONAL: User's encdoded in a KERB_CRED message, encrypted with session key from service ticket
  97. } KERB_TICKET_LOGON, *PKERB_TICKET_LOGON;
  98. //
  99. // Flags for the ticket logon flags field
  100. //
  101. #define KERB_LOGON_FLAG_ALLOW_EXPIRED_TICKET 0x1
  102. typedef struct _KERB_TICKET_UNLOCK_LOGON {
  103. KERB_TICKET_LOGON Logon;
  104. LUID LogonId;
  105. } KERB_TICKET_UNLOCK_LOGON, *PKERB_TICKET_UNLOCK_LOGON;
  106. //
  107. // Used for S4U Client requests
  108. //
  109. //
  110. typedef struct _KERB_S4U_LOGON {
  111. KERB_LOGON_SUBMIT_TYPE MessageType;
  112. ULONG Flags;
  113. UNICODE_STRING ClientUpn; // REQUIRED: UPN for client
  114. UNICODE_STRING ClientRealm; // Optional: Client Realm, if known
  115. } KERB_S4U_LOGON, *PKERB_S4U_LOGON;
  116. //
  117. // Use the same profile structure as MSV1_0
  118. //
  119. typedef enum _KERB_PROFILE_BUFFER_TYPE {
  120. KerbInteractiveProfile = 2,
  121. KerbSmartCardProfile = 4,
  122. KerbTicketProfile = 6
  123. } KERB_PROFILE_BUFFER_TYPE, *PKERB_PROFILE_BUFFER_TYPE;
  124. typedef struct _KERB_INTERACTIVE_PROFILE {
  125. KERB_PROFILE_BUFFER_TYPE MessageType;
  126. USHORT LogonCount;
  127. USHORT BadPasswordCount;
  128. LARGE_INTEGER LogonTime;
  129. LARGE_INTEGER LogoffTime;
  130. LARGE_INTEGER KickOffTime;
  131. LARGE_INTEGER PasswordLastSet;
  132. LARGE_INTEGER PasswordCanChange;
  133. LARGE_INTEGER PasswordMustChange;
  134. UNICODE_STRING LogonScript;
  135. UNICODE_STRING HomeDirectory;
  136. UNICODE_STRING FullName;
  137. UNICODE_STRING ProfilePath;
  138. UNICODE_STRING HomeDirectoryDrive;
  139. UNICODE_STRING LogonServer;
  140. ULONG UserFlags;
  141. } KERB_INTERACTIVE_PROFILE, *PKERB_INTERACTIVE_PROFILE;
  142. //
  143. // For smart card, we return a smart card profile, which is an interactive
  144. // profile plus a certificate
  145. //
  146. typedef struct _KERB_SMART_CARD_PROFILE {
  147. KERB_INTERACTIVE_PROFILE Profile;
  148. ULONG CertificateSize;
  149. PUCHAR CertificateData;
  150. } KERB_SMART_CARD_PROFILE, *PKERB_SMART_CARD_PROFILE;
  151. //
  152. // For a ticket logon profile, we return the session key from the ticket
  153. //
  154. typedef struct KERB_CRYPTO_KEY {
  155. LONG KeyType;
  156. ULONG Length;
  157. PUCHAR Value;
  158. } KERB_CRYPTO_KEY, *PKERB_CRYPTO_KEY;
  159. typedef struct _KERB_TICKET_PROFILE {
  160. KERB_INTERACTIVE_PROFILE Profile;
  161. KERB_CRYPTO_KEY SessionKey;
  162. } KERB_TICKET_PROFILE, *PKERB_TICKET_PROFILE;
  163. typedef enum _KERB_PROTOCOL_MESSAGE_TYPE {
  164. KerbDebugRequestMessage = 0,
  165. KerbQueryTicketCacheMessage,
  166. KerbChangeMachinePasswordMessage,
  167. KerbVerifyPacMessage,
  168. KerbRetrieveTicketMessage,
  169. KerbUpdateAddressesMessage,
  170. KerbPurgeTicketCacheMessage,
  171. KerbChangePasswordMessage,
  172. KerbRetrieveEncodedTicketMessage,
  173. KerbDecryptDataMessage,
  174. KerbAddBindingCacheEntryMessage,
  175. KerbSetPasswordMessage,
  176. KerbSetPasswordExMessage,
  177. KerbVerifyCredentialsMessage,
  178. KerbQueryTicketCacheExMessage,
  179. KerbPurgeTicketCacheExMessage,
  180. KerbRefreshSmartcardCredentialsMessage,
  181. KerbAddExtraCredentialsMessage,
  182. KerbQuerySupplementalCredentialsMessage
  183. } KERB_PROTOCOL_MESSAGE_TYPE, *PKERB_PROTOCOL_MESSAGE_TYPE;
  184. // end_ntsecapi
  185. //
  186. // Structure for a debuggin requequest
  187. //
  188. #define KERB_DEBUG_REQ_BREAKPOINT 0x1
  189. #define KERB_DEBUG_REQ_CALL_PACK 0x2
  190. #define KERB_DEBUG_REQ_DATAGRAM 0x3
  191. #define KERB_DEBUG_REQ_STATISTICS 0x4
  192. #define KERB_DEBUG_CREATE_TOKEN 0x5
  193. typedef struct _KERB_DEBUG_REQUEST {
  194. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  195. ULONG DebugRequest;
  196. } KERB_DEBUG_REQUEST, *PKERB_DEBUG_REQUEST;
  197. typedef struct _KERB_DEBUG_REPLY {
  198. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  199. UCHAR Data[ANYSIZE_ARRAY];
  200. } KERB_DEBUG_REPLY, *PKERB_DEBUG_REPLY;
  201. typedef struct _KERB_DEBUG_STATS {
  202. ULONG CacheHits;
  203. ULONG CacheMisses;
  204. ULONG SkewedRequests;
  205. ULONG SuccessRequests;
  206. LARGE_INTEGER LastSync;
  207. } KERB_DEBUG_STATS, *PKERB_DEBUG_STATS;
  208. #if 0
  209. typedef struct _KERB_EXTERNAL_TICKET_EX {
  210. PKERB_EXTERNAL_NAME ClientName;
  211. PKERB_EXTERNAL_NAME ServiceName;
  212. PKERB_EXTERNAL_NAME TargetName;
  213. UNICODE_STRING ClientRealm;
  214. UNICODE_STRING ServiceRealm;
  215. UNICODE_STRING AltTargetDomainName;
  216. KERB_CRYPTO_KEY SessionKey;
  217. ULONG TicketFlags;
  218. ULONG Flags;
  219. LARGE_INTEGER KeyExpirationTime;
  220. LARGE_INTEGER StartTime;
  221. LARGE_INTEGER EndTime;
  222. LARGE_INTEGER RenewUntil;
  223. LARGE_INTEGER TimeSkew;
  224. PKERB_NET_ADDRESSES TicketAddresses;
  225. PKERB_AUTH_DATA AuthorizationData;
  226. _KERB_EXTERNAL_TICKET_EX * SecondTicket;
  227. ULONG EncodedTicketSize;
  228. PUCHAR EncodedTicket;
  229. } KERB_EXTERNAL_TICKET_EX, *PKERB_EXTERNAL_TICKET_EX;
  230. typedef struct _KERB_RETRIEVE_TKT_EX_REQUEST {
  231. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  232. LUID LogonId;
  233. KERB_TICKET_CACHE_INFO_EX TicketTemplate;
  234. ULONG CacheOptions;
  235. SecHandle CredentialsHandle;
  236. PKERB_EXTERNAL_TICKET_EX SecondTicket;
  237. PKERB_AUTH_DATA UserAuthData;
  238. PKERB_NET_ADDRESS Addresses;
  239. } KERB_RETRIEVE_TKT_EX_REQUEST, *PKERB_RETRIEVE_TKT_EX_REQUEST;
  240. typedef struct _KERB_RETRIEVE_TKT_EX_RESPONSE {
  241. KERB_EXTERNAL_TICKET_EX Ticket;
  242. } KERB_RETRIEVE_TKT_EX_RESPONSE, *PKERB_RETRIEVE_TKT_EX_RESPONSE;
  243. #endif // 0
  244. // begin_ntsecapi
  245. //
  246. // Used both for retrieving tickets and for querying ticket cache
  247. //
  248. typedef struct _KERB_QUERY_TKT_CACHE_REQUEST {
  249. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  250. LUID LogonId;
  251. } KERB_QUERY_TKT_CACHE_REQUEST, *PKERB_QUERY_TKT_CACHE_REQUEST;
  252. typedef struct _KERB_TICKET_CACHE_INFO {
  253. UNICODE_STRING ServerName;
  254. UNICODE_STRING RealmName;
  255. LARGE_INTEGER StartTime;
  256. LARGE_INTEGER EndTime;
  257. LARGE_INTEGER RenewTime;
  258. LONG EncryptionType;
  259. ULONG TicketFlags;
  260. } KERB_TICKET_CACHE_INFO, *PKERB_TICKET_CACHE_INFO;
  261. typedef struct _KERB_TICKET_CACHE_INFO_EX {
  262. UNICODE_STRING ClientName;
  263. UNICODE_STRING ClientRealm;
  264. UNICODE_STRING ServerName;
  265. UNICODE_STRING ServerRealm;
  266. LARGE_INTEGER StartTime;
  267. LARGE_INTEGER EndTime;
  268. LARGE_INTEGER RenewTime;
  269. LONG EncryptionType;
  270. ULONG TicketFlags;
  271. } KERB_TICKET_CACHE_INFO_EX, *PKERB_TICKET_CACHE_INFO_EX;
  272. typedef struct _KERB_QUERY_TKT_CACHE_RESPONSE {
  273. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  274. ULONG CountOfTickets;
  275. KERB_TICKET_CACHE_INFO Tickets[ANYSIZE_ARRAY];
  276. } KERB_QUERY_TKT_CACHE_RESPONSE, *PKERB_QUERY_TKT_CACHE_RESPONSE;
  277. typedef struct _KERB_QUERY_TKT_CACHE_EX_RESPONSE {
  278. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  279. ULONG CountOfTickets;
  280. KERB_TICKET_CACHE_INFO_EX Tickets[ANYSIZE_ARRAY];
  281. } KERB_QUERY_TKT_CACHE_EX_RESPONSE, *PKERB_QUERY_TKT_CACHE_EX_RESPONSE;
  282. //
  283. // Types for retrieving encoded ticket from the cache
  284. //
  285. #ifndef __SECHANDLE_DEFINED__
  286. typedef struct _SecHandle
  287. {
  288. ULONG_PTR dwLower ;
  289. ULONG_PTR dwUpper ;
  290. } SecHandle, * PSecHandle ;
  291. #define __SECHANDLE_DEFINED__
  292. #endif // __SECHANDLE_DEFINED__
  293. // Ticket Flags
  294. #define KERB_USE_DEFAULT_TICKET_FLAGS 0x0
  295. // CacheOptions
  296. #define KERB_RETRIEVE_TICKET_DEFAULT 0x0
  297. #define KERB_RETRIEVE_TICKET_DONT_USE_CACHE 0x1
  298. #define KERB_RETRIEVE_TICKET_USE_CACHE_ONLY 0x2
  299. #define KERB_RETRIEVE_TICKET_USE_CREDHANDLE 0x4
  300. #define KERB_RETRIEVE_TICKET_AS_KERB_CRED 0x8
  301. #define KERB_RETRIEVE_TICKET_WITH_SEC_CRED 0x10
  302. // Encryption Type options
  303. #define KERB_ETYPE_DEFAULT 0x0 // don't specify etype in tkt req.
  304. typedef struct _KERB_AUTH_DATA {
  305. ULONG Type;
  306. ULONG Length;
  307. PUCHAR Data;
  308. } KERB_AUTH_DATA, *PKERB_AUTH_DATA;
  309. typedef struct _KERB_NET_ADDRESS {
  310. ULONG Family;
  311. ULONG Length;
  312. PCHAR Address;
  313. } KERB_NET_ADDRESS, *PKERB_NET_ADDRESS;
  314. typedef struct _KERB_NET_ADDRESSES {
  315. ULONG Number;
  316. KERB_NET_ADDRESS Addresses[ANYSIZE_ARRAY];
  317. } KERB_NET_ADDRESSES, *PKERB_NET_ADDRESSES;
  318. //
  319. // Types for the information about a ticket
  320. //
  321. typedef struct _KERB_EXTERNAL_NAME {
  322. SHORT NameType;
  323. USHORT NameCount;
  324. UNICODE_STRING Names[ANYSIZE_ARRAY];
  325. } KERB_EXTERNAL_NAME, *PKERB_EXTERNAL_NAME;
  326. typedef struct _KERB_EXTERNAL_TICKET {
  327. PKERB_EXTERNAL_NAME ServiceName;
  328. PKERB_EXTERNAL_NAME TargetName;
  329. PKERB_EXTERNAL_NAME ClientName;
  330. UNICODE_STRING DomainName;
  331. UNICODE_STRING TargetDomainName;
  332. UNICODE_STRING AltTargetDomainName; // contains ClientDomainName
  333. KERB_CRYPTO_KEY SessionKey;
  334. ULONG TicketFlags;
  335. ULONG Flags;
  336. LARGE_INTEGER KeyExpirationTime;
  337. LARGE_INTEGER StartTime;
  338. LARGE_INTEGER EndTime;
  339. LARGE_INTEGER RenewUntil;
  340. LARGE_INTEGER TimeSkew;
  341. ULONG EncodedTicketSize;
  342. PUCHAR EncodedTicket;
  343. } KERB_EXTERNAL_TICKET, *PKERB_EXTERNAL_TICKET;
  344. typedef struct _KERB_RETRIEVE_TKT_REQUEST {
  345. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  346. LUID LogonId;
  347. UNICODE_STRING TargetName;
  348. ULONG TicketFlags;
  349. ULONG CacheOptions;
  350. LONG EncryptionType;
  351. SecHandle CredentialsHandle;
  352. } KERB_RETRIEVE_TKT_REQUEST, *PKERB_RETRIEVE_TKT_REQUEST;
  353. typedef struct _KERB_RETRIEVE_TKT_RESPONSE {
  354. KERB_EXTERNAL_TICKET Ticket;
  355. } KERB_RETRIEVE_TKT_RESPONSE, *PKERB_RETRIEVE_TKT_RESPONSE;
  356. //
  357. // Used to purge entries from the ticket cache
  358. //
  359. typedef struct _KERB_PURGE_TKT_CACHE_REQUEST {
  360. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  361. LUID LogonId;
  362. UNICODE_STRING ServerName;
  363. UNICODE_STRING RealmName;
  364. } KERB_PURGE_TKT_CACHE_REQUEST, *PKERB_PURGE_TKT_CACHE_REQUEST;
  365. //
  366. // Flags for purge requests
  367. //
  368. #define KERB_PURGE_ALL_TICKETS 1
  369. typedef struct _KERB_PURGE_TKT_CACHE_EX_REQUEST {
  370. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  371. LUID LogonId;
  372. ULONG Flags;
  373. KERB_TICKET_CACHE_INFO_EX TicketTemplate;
  374. } KERB_PURGE_TKT_CACHE_EX_REQUEST, *PKERB_PURGE_TKT_CACHE_EX_REQUEST;
  375. // end_ntsecapi
  376. //
  377. // This must match NT_OWF_PASSWORD_LENGTH
  378. //
  379. typedef struct _KERB_CHANGE_MACH_PWD_REQUEST {
  380. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  381. UNICODE_STRING NewPassword;
  382. UNICODE_STRING OldPassword;
  383. } KERB_CHANGE_MACH_PWD_REQUEST, *PKERB_CHANGE_MACH_PWD_REQUEST;
  384. //
  385. // These messages are used by the kerberos package to verify that the PAC in a
  386. // ticket is valid. It is remoted from a workstation to a DC in the workstation's
  387. // domain. On failure there is no response message. On success there may be no
  388. // message or the same message may be used to send back a PAC updated with
  389. // local groups from the domain controller. The checksum is placed in the
  390. // final buffer first, followed by the signature.
  391. //
  392. #include <pshpack1.h>
  393. typedef struct _KERB_VERIFY_PAC_REQUEST {
  394. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  395. ULONG ChecksumLength;
  396. ULONG SignatureType;
  397. ULONG SignatureLength;
  398. UCHAR ChecksumAndSignature[ANYSIZE_ARRAY];
  399. } KERB_VERIFY_PAC_REQUEST, *PKERB_VERIFY_PAC_REQUEST;
  400. //
  401. // Message for update Kerberos's list of addresses. The address count should
  402. // be the number of addresses & the addresses should be an array of
  403. // SOCKET_ADDRESS structures. The message type should be KerbUpdateAddressesMessage
  404. //
  405. typedef struct _KERB_UPDATE_ADDRESSES_REQUEST {
  406. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  407. ULONG AddressCount;
  408. ULONG Addresses[ANYSIZE_ARRAY]; // array of SOCKET_ADDRESS structures
  409. } KERB_UPDATE_ADDRESSES_REQUEST, *PKERB_UPDATE_ADDRESSES_REQUEST;
  410. #include <poppack.h>
  411. // begin_ntsecapi
  412. //
  413. // KerbChangePassword
  414. //
  415. // KerbChangePassword changes the password on the KDC account plus
  416. // the password cache and logon credentials if applicable.
  417. //
  418. //
  419. typedef struct _KERB_CHANGEPASSWORD_REQUEST {
  420. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  421. UNICODE_STRING DomainName;
  422. UNICODE_STRING AccountName;
  423. UNICODE_STRING OldPassword;
  424. UNICODE_STRING NewPassword;
  425. BOOLEAN Impersonating;
  426. } KERB_CHANGEPASSWORD_REQUEST, *PKERB_CHANGEPASSWORD_REQUEST;
  427. //
  428. // KerbSetPassword
  429. //
  430. // KerbSetPassword changes the password on the KDC account plus
  431. // the password cache and logon credentials if applicable.
  432. //
  433. //
  434. typedef struct _KERB_SETPASSWORD_REQUEST {
  435. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  436. LUID LogonId;
  437. SecHandle CredentialsHandle;
  438. ULONG Flags;
  439. UNICODE_STRING DomainName;
  440. UNICODE_STRING AccountName;
  441. UNICODE_STRING Password;
  442. } KERB_SETPASSWORD_REQUEST, *PKERB_SETPASSWORD_REQUEST;
  443. typedef struct _KERB_SETPASSWORD_EX_REQUEST {
  444. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  445. LUID LogonId;
  446. SecHandle CredentialsHandle;
  447. ULONG Flags;
  448. UNICODE_STRING AccountRealm;
  449. UNICODE_STRING AccountName;
  450. UNICODE_STRING Password;
  451. UNICODE_STRING ClientRealm;
  452. UNICODE_STRING ClientName;
  453. BOOLEAN Impersonating;
  454. UNICODE_STRING KdcAddress;
  455. ULONG KdcAddressType;
  456. } KERB_SETPASSWORD_EX_REQUEST, *PKERB_SETPASSWORD_EX_REQUEST;
  457. #define DS_UNKNOWN_ADDRESS_TYPE 0 // anything *but* IP
  458. #define KERB_SETPASS_USE_LOGONID 1
  459. #define KERB_SETPASS_USE_CREDHANDLE 2
  460. typedef struct _KERB_DECRYPT_REQUEST {
  461. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  462. LUID LogonId;
  463. ULONG Flags;
  464. LONG CryptoType;
  465. LONG KeyUsage;
  466. KERB_CRYPTO_KEY Key; // optional
  467. ULONG EncryptedDataSize;
  468. ULONG InitialVectorSize;
  469. PUCHAR InitialVector;
  470. PUCHAR EncryptedData;
  471. } KERB_DECRYPT_REQUEST, *PKERB_DECRYPT_REQUEST;
  472. //
  473. // If set, use the primary key from the current logon session of the one provided in the LogonId field.
  474. // Otherwise, use the Key in the KERB_DECRYPT_MESSAGE.
  475. #define KERB_DECRYPT_FLAG_DEFAULT_KEY 0x00000001
  476. typedef struct _KERB_DECRYPT_RESPONSE {
  477. UCHAR DecryptedData[ANYSIZE_ARRAY];
  478. } KERB_DECRYPT_RESPONSE, *PKERB_DECRYPT_RESPONSE;
  479. //
  480. // Request structure for adding a binding cache entry. TCB privilege
  481. // is required for this operation.
  482. //
  483. typedef struct _KERB_ADD_BINDING_CACHE_ENTRY_REQUEST {
  484. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  485. UNICODE_STRING RealmName;
  486. UNICODE_STRING KdcAddress;
  487. ULONG AddressType; //dsgetdc.h DS_NETBIOS_ADDRESS||DS_INET_ADDRESS
  488. } KERB_ADD_BINDING_CACHE_ENTRY_REQUEST, *PKERB_ADD_BINDING_CACHE_ENTRY_REQUEST;
  489. //
  490. // Request structure for reacquiring smartcard credentials for a
  491. // given LUID.
  492. // Requires TCB.
  493. //
  494. typedef struct _KERB_REFRESH_SCCRED_REQUEST {
  495. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  496. UNICODE_STRING CredentialBlob; // optional
  497. LUID LogonId;
  498. ULONG Flags;
  499. } KERB_REFRESH_SCCRED_REQUEST, *PKERB_REFRESH_SCCRED_REQUEST;
  500. //
  501. // Flags for KERB_REFRESH_SCCRED_REQUEST
  502. //
  503. // KERB_REFRESH_SCCRED_RELEASE
  504. // Release the smartcard handle for LUID
  505. //
  506. // KERB_REFRESH_SCCRED_GETTGT
  507. // Use the certificate hash in the blob to get a TGT for the logon
  508. // session.
  509. //
  510. #define KERB_REFRESH_SCCRED_RELEASE 0x0
  511. #define KERB_REFRESH_SCCRED_GETTGT 0x1
  512. //
  513. // Request structure for adding extra Server credentials to a given
  514. // logon session. Only applicable during AcceptSecurityContext, and
  515. // requires TCB to alter "other" creds
  516. //
  517. typedef struct _KERB_ADD_CREDENTIALS_REQUEST {
  518. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  519. UNICODE_STRING UserName;
  520. UNICODE_STRING DomainName;
  521. UNICODE_STRING Password;
  522. LUID LogonId; // optional
  523. ULONG Flags;
  524. } KERB_ADD_CREDENTIALS_REQUEST, *PKERB_ADD_CREDENTIALS_REQUEST;
  525. #define KERB_REQUEST_ADD_CREDENTIAL 1
  526. #define KERB_REQUEST_REPLACE_CREDENTIAL 2
  527. #define KERB_REQUEST_REMOVE_CREDENTIAL 4
  528. // end_ntsecapi
  529. //
  530. // The following are in process calls only
  531. //
  532. #ifdef _WINCRED_H_
  533. typedef struct _KERB_QUERY_SUPPLEMENTAL_CREDS_REQUEST {
  534. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  535. UNICODE_STRING PackageName;
  536. PCREDENTIALW MarshalledCreds;
  537. LUID LogonId;
  538. ULONG Flags;
  539. } KERB_QUERY_SUPPLEMENTAL_CREDS_REQUEST, * PKERB_QUERY_SUPPLEMENTAL_CREDS_REQUEST;
  540. typedef struct _KERB_QUERY_SUPPLEMENTAL_CREDS_RESPONSE {
  541. ENCRYPTED_CREDENTIALW ReturnedCreds;
  542. } KERB_QUERY_SUPPLEMENTAL_CREDS_RESPONSE, * PKERB_QUERY_SUPPLEMENTAL_CREDS_RESPONSE;
  543. #endif // wincred
  544. typedef struct _KERB_VERIFY_CREDENTIALS_REQUEST {
  545. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  546. UNICODE_STRING UserName;
  547. UNICODE_STRING DomainName;
  548. UNICODE_STRING Password;
  549. ULONG VerifyFlags;
  550. } KERB_VERIFY_CREDENTIALS_REQUEST, *PKERB_VERIFY_CREDENTIALS_REQUEST;
  551. //
  552. // Location of Kerb authentication package data
  553. //
  554. #define KERB_SUBAUTHENTICATION_KEY "SYSTEM\\CurrentControlSet\\Control\\Lsa\\Kerberos"
  555. #define KERB_SUBAUTHENTICATION_VALUE "Auth"
  556. #define KERB_SUBAUTHENTICATION_MASK 0x7fffffff
  557. #define KERB_SUBAUTHENTICATION_FLAG 0x80000000
  558. #endif // __KERBEROS_H__