7
Network Working Group J. Wray
8
Request for Comments: 1509 Digital Equipment Corporation
12
Generic Security Service API : C-bindings
16
This RFC specifies an Internet standards track protocol for the
17
Internet community, and requests discussion and suggestions for
18
improvements. Please refer to the current edition of the "Internet
19
Official Protocol Standards" for the standardization state and status
20
of this protocol. Distribution of this memo is unlimited.
24
This document specifies C language bindings for the Generic Security
25
Service Application Program Interface (GSS-API), which is described
26
at a language-independent conceptual level in other documents.
28
The Generic Security Service Application Programming Interface (GSS-
29
API) provides security services to its callers, and is intended for
30
implementation atop alternative underlying cryptographic mechanisms.
31
Typically, GSS-API callers will be application protocols into which
32
security enhancements are integrated through invocation of services
33
provided by the GSS-API. The GSS-API allows a caller application to
34
authenticate a principal identity associated with a peer application,
35
to delegate rights to a peer, and to apply security services such as
36
confidentiality and integrity on a per-message basis.
40
The Generic Security Service Application Programming Interface [1]
41
provides security services to calling applications. It allows a
42
communicating application to authenticate the user associated with
43
another application, to delegate rights to another application, and
44
to apply security services such as confidentiality and integrity on a
47
There are four stages to using the GSSAPI:
49
(a) The application acquires a set of credentials with which it may
50
prove its identity to other processes. The application's
51
credentials vouch for its global identity, which may or may not
52
be related to the local username under which it is running.
60
RFC 1509 GSSAPI - Overview and C bindings September 1993
63
(b) A pair of communicating applications establish a joint security
64
context using their credentials. The security context is a
65
pair of GSSAPI data structures that contain shared state
66
information, which is required in order that per-message
67
security services may be provided. As part of the
68
establishment of a security context, the context initiator is
69
authenticated to the responder, and may require that the
70
responder is authenticated in turn. The initiator may
71
optionally give the responder the right to initiate further
72
security contexts. This transfer of rights is termed
73
delegation, and is achieved by creating a set of credentials,
74
similar to those used by the originating application, but which
75
may be used by the responder. To establish and maintain the
76
shared information that makes up the security context, certain
77
GSSAPI calls will return a token data structure, which is a
78
cryptographically protected opaque data type. The caller of
79
such a GSSAPI routine is responsible for transferring the token
80
to the peer application, which should then pass it to a
81
corresponding GSSAPI routine which will decode it and extract
84
(c) Per-message services are invoked to apply either:
86
(i) integrity and data origin authentication, or
88
(ii) confidentiality, integrity and data origin authentication
89
to application data, which are treated by GSSAPI as
90
arbitrary octet-strings. The application transmitting a
91
message that it wishes to protect will call the appropriate
92
GSSAPI routine (sign or seal) to apply protection, specifying
93
the appropriate security context, and send the result to the
94
receiving application. The receiver will pass the received
95
data to the corresponding decoding routine (verify or unseal)
96
to remove the protection and validate the data.
98
(d) At the completion of a communications session (which may extend
99
across several connections), the peer applications call GSSAPI
100
routines to delete the security context. Multiple contexts may
101
also be used (either successively or simultaneously) within a
102
single communications association.
106
This section lists the functions performed by each of the GSSAPI
107
routines and discusses their major parameters, describing how they
108
are to be passed to the routines. The routines are listed in figure
116
RFC 1509 GSSAPI - Overview and C bindings September 1993
119
Figure 4-1 GSSAPI Routines
124
gss_acquire_cred Assume a global identity
126
gss_release_cred Discard credentials
128
gss_init_sec_context Initiate a security context
129
with a peer application
131
gss_accept_sec_context Accept a security context
135
gss_process_context_token Process a token on a security
139
gss_delete_sec_context Discard a security context
141
gss_context_time Determine for how long a
142
context will remain valid
144
gss_sign Sign a message; integrity
147
gss_verify Check signature on a message
149
gss_seal Sign (optionally encrypt) a
150
message; confidentiality
153
gss_unseal Verify (optionally decrypt)
156
gss_display_status Convert an API status code
159
gss_indicate_mechs Determine underlying
160
authentication mechanism
162
gss_compare_name Compare two internal-form
165
gss_display_name Convert opaque name to text
172
RFC 1509 GSSAPI - Overview and C bindings September 1993
175
gss_import_name Convert a textual name to
178
gss_release_name Discard an internal-form
181
gss_release_buffer Discard a buffer
183
gss_release_oid_set Discard a set of object
186
gss_inquire_cred Determine information about
189
Individual GSSAPI implementations may augment these routines by
190
providing additional mechanism-specific routines if required
191
functionality is not available from the generic forms. Applications
192
are encouraged to use the generic routines wherever possible on
195
2.1. Data Types and Calling Conventions
197
The following conventions are used by the GSSAPI:
199
2.1.1. Structured data types
201
Wherever these GSSAPI C-bindings describe structured data, only
202
fields that must be provided by all GSSAPI implementation are
203
documented. Individual implementations may provide additional
204
fields, either for internal use within GSSAPI routines, or for use by
205
non-portable applications.
209
GSSAPI defines the following integer data type:
211
OM_uint32 32-bit unsigned integer
213
Where guaranteed minimum bit-count is important, this portable data
214
type is used by the GSSAPI routine definitions. Individual GSSAPI
215
implementations will include appropriate typedef definitions to map
216
this type onto a built-in data type.
218
2.1.3. String and similar data
220
Many of the GSSAPI routines take arguments and return values that
221
describe contiguous multiple-byte data. All such data is passed
222
between the GSSAPI and the caller using the gss_buffer_t data type.
228
RFC 1509 GSSAPI - Overview and C bindings September 1993
231
This data type is a pointer to a buffer descriptor, which consists of
232
a length field that contains the total number of bytes in the datum,
233
and a value field which contains a pointer to the actual datum:
235
typedef struct gss_buffer_desc_struct {
238
} gss_buffer_desc, *gss_buffer_t;
240
Storage for data passed to the application by a GSSAPI routine using
241
the gss_buffer_t conventions is allocated by the GSSAPI routine. The
242
application may free this storage by invoking the gss_release_buffer
243
routine. Allocation of the gss_buffer_desc object is always the
244
responsibility of the application; Unused gss_buffer_desc objects
245
may be initialized to the value GSS_C_EMPTY_BUFFER.
247
2.1.3.1. Opaque data types
249
Certain multiple-word data items are considered opaque data types at
250
the GSSAPI, because their internal structure has no significance
251
either to the GSSAPI or to the caller. Examples of such opaque data
252
types are the input_token parameter to gss_init_sec_context (which is
253
opaque to the caller), and the input_message parameter to gss_seal
254
(which is opaque to the GSSAPI). Opaque data is passed between the
255
GSSAPI and the application using the gss_buffer_t datatype.
257
2.1.3.2. Character strings
259
Certain multiple-word data items may be regarded as simple ISO
260
Latin-1 character strings. An example of this is the
261
input_name_buffer parameter to gss_import_name. Some GSSAPI routines
262
also return character strings. Character strings are passed between
263
the application and the GSSAPI using the gss_buffer_t datatype,
266
2.1.4. Object Identifiers
268
Certain GSSAPI procedures take parameters of the type gss_OID, or
269
Object identifier. This is a type containing ISO-defined tree-
270
structured values, and is used by the GSSAPI caller to select an
271
underlying security mechanism. A value of type gss_OID has the
274
typedef struct gss_OID_desc_struct {
277
} gss_OID_desc, *gss_OID;
284
RFC 1509 GSSAPI - Overview and C bindings September 1993
287
The elements field of this structure points to the first byte of an
288
octet string containing the ASN.1 BER encoding of the value of the
289
gss_OID. The length field contains the number of bytes in this
290
value. For example, the gss_OID value corresponding to {iso(1)
291
identified- oganization(3) icd-ecma(12) member-company(2) dec(1011)
292
cryptoAlgorithms(7) SPX(5)} meaning SPX (Digital's X.509
293
authentication mechanism) has a length field of 7 and an elements
294
field pointing to seven octets containing the following octal values:
295
53,14,2,207,163,7,5. GSSAPI implementations should provide constant
296
gss_OID values to allow callers to request any supported mechanism,
297
although applications are encouraged on portability grounds to accept
298
the default mechanism. gss_OID values should also be provided to
299
allow applications to specify particular name types (see section
300
2.1.10). Applications should treat gss_OID_desc values returned by
301
GSSAPI routines as read-only. In particular, the application should
302
not attempt to deallocate them. The gss_OID_desc datatype is
303
equivalent to the X/Open OM_object_identifier datatype [2].
305
2.1.5. Object Identifier Sets
307
Certain GSSAPI procedures take parameters of the type gss_OID_set.
308
This type represents one or more object identifiers (section 2.1.4).
309
A gss_OID_set object has the following structure:
311
typedef struct gss_OID_set_desc_struct {
314
} gss_OID_set_desc, *gss_OID_set;
316
The count field contains the number of OIDs within the set. The
317
elements field is a pointer to an array of gss_OID_desc objects, each
318
of which describes a single OID. gss_OID_set values are used to name
319
the available mechanisms supported by the GSSAPI, to request the use
320
of specific mechanisms, and to indicate which mechanisms a given
321
credential supports. Storage associated with gss_OID_set values
322
returned to the application by the GSSAPI may be deallocated by the
323
gss_release_oid_set routine.
327
A credential handle is a caller-opaque atomic datum that identifies a
328
GSSAPI credential data structure. It is represented by the caller-
329
opaque type gss_cred_id_t, which may be implemented as either an
330
arithmetic or a pointer type. Credentials describe a principal, and
331
they give their holder the ability to act as that principal. The
332
GSSAPI does not make the actual credentials available to
333
applications; instead the credential handle is used to identify a
334
particular credential, held internally by GSSAPI or underlying
340
RFC 1509 GSSAPI - Overview and C bindings September 1993
343
mechanism. Thus the credential handle contains no security-relavent
344
information, and requires no special protection by the application.
345
Depending on the implementation, a given credential handle may refer
346
to different credentials when presented to the GSSAPI by different
347
callers. Individual GSSAPI implementations should define both the
348
scope of a credential handle and the scope of a credential itself
349
(which must be at least as wide as that of a handle). Possibilities
350
for credential handle scope include the process that acquired the
351
handle, the acquiring process and its children, or all processes
352
sharing some local identification information (e.g., UID). If no
353
handles exist by which a given credential may be reached, the GSSAPI
354
may delete the credential.
356
Certain routines allow credential handle parameters to be omitted to
357
indicate the use of a default credential. The mechanism by which a
358
default credential is established and its scope should be defined by
359
the individual GSSAPI implementation.
363
The gss_ctx_id_t data type contains a caller-opaque atomic value that
364
identifies one end of a GSSAPI security context. It may be
365
implemented as either an arithmetic or a pointer type. Depending on
366
the implementation, a given gss_ctx_id_t value may refer to different
367
GSSAPI security contexts when presented to the GSSAPI by different
368
callers. The security context holds state information about each end
369
of a peer communication, including cryptographic state information.
370
Individual GSSAPI implementations should define the scope of a
371
context. Since no way is provided by which a new gss_ctx_id_t value
372
may be obtained for an existing context, the scope of a context
373
should be the same as the scope of a gss_ctx_id_t.
375
2.1.8. Authentication tokens
377
A token is a caller-opaque type that GSSAPI uses to maintain
378
synchronization between the context data structures at each end of a
379
GSSAPI security context. The token is a cryptographically protected
380
bit-string, generated by the underlying mechanism at one end of a
381
GSSAPI security context for use by the peer mechanism at the other
382
end. Encapsulation (if required) and transfer of the token are the
383
responsibility of the peer applications. A token is passed between
384
the GSSAPI and the application using the gss_buffer_t conventions.
388
One or more status codes are returned by each GSSAPI routine. Two
389
distinct sorts of status codes are returned. These are termed GSS
390
status codes and Mechanism status codes.
396
RFC 1509 GSSAPI - Overview and C bindings September 1993
399
2.1.9.1. GSS status codes
401
GSSAPI routines return GSS status codes as their OM_uint32 function
402
value. These codes indicate errors that are independent of the
403
underlying mechanism used to provide the security service. The
404
errors that can be indicated via a GSS status code are either generic
405
API routine errors (errors that are defined in the GSSAPI
406
specification) or calling errors (errors that are specific to these
409
A GSS status code can indicate a single fatal generic API error from
410
the routine and a single calling error. In addition, supplementary
411
status information may be indicated via the setting of bits in the
412
supplementary info field of a GSS status code.
414
These errors are encoded into the 32-bit GSS status code as follows:
417
|------------------------------------------------------------|
418
| Calling Error | Routine Error | Supplementary Info |
419
|------------------------------------------------------------|
422
Hence if a GSSAPI routine returns a GSS status code whose upper 16
423
bits contain a non-zero value, the call failed. If the calling error
424
field is non-zero, the invoking application's call of the routine was
425
erroneous. Calling errors are defined in table 5-1. If the routine
426
error field is non-zero, the routine failed for one of the routine-
427
specific reasons listed below in table 5-2. Whether or not the upper
428
16 bits indicate a failure or a success, the routine may indicate
429
additional information by setting bits in the supplementary info
430
field of the status code. The meaning of individual bits is listed
433
Table 5-1 Calling Errors
435
Name Value in Meaning
437
GSS_S_CALL_INACCESSIBLE_READ 1 A required input
440
GSS_S_CALL_INACCESSIBLE_WRITE 2 A required output
443
GSS_S_CALL_BAD_STRUCTURE 3 A parameter was
452
RFC 1509 GSSAPI - Overview and C bindings September 1993
455
Table 5-2 Routine Errors
457
Name Value in Meaning
460
GSS_S_BAD_MECH 1 An unsupported mechanism was
462
GSS_S_BAD_NAME 2 An invalid name was supplied
463
GSS_S_BAD_NAMETYPE 3 A supplied name was of an
465
GSS_S_BAD_BINDINGS 4 Incorrect channel bindings
467
GSS_S_BAD_STATUS 5 An invalid status code was
470
GSS_S_BAD_SIG 6 A token had an invalid
472
GSS_S_NO_CRED 7 No credentials were supplied
473
GSS_S_NO_CONTEXT 8 No context has been
475
GSS_S_DEFECTIVE_TOKEN 9 A token was invalid
476
GSS_S_DEFECTIVE_CREDENTIAL 10 A credential was invalid
477
GSS_S_CREDENTIALS_EXPIRED 11 The referenced credentials
479
GSS_S_CONTEXT_EXPIRED 12 The context has expired
480
GSS_S_FAILURE 13 Miscellaneous failure
483
Table 5-3 Supplementary Status Bits
485
Name Bit Number Meaning
486
GSS_S_CONTINUE_NEEDED 0 (LSB) The routine must be called
487
again to complete its
489
See routine documentation for
490
detailed description.
491
GSS_S_DUPLICATE_TOKEN 1 The token was a duplicate of
493
GSS_S_OLD_TOKEN 2 The token's validity period
495
GSS_S_UNSEQ_TOKEN 3 A later token has already been
498
The routine documentation also uses the name GSS_S_COMPLETE, which is
499
a zero value, to indicate an absence of any API errors or
500
supplementary information bits.
508
RFC 1509 GSSAPI - Overview and C bindings September 1993
511
All GSS_S_xxx symbols equate to complete OM_uint32 status codes,
512
rather than to bitfield values. For example, the actual value of the
513
symbol GSS_S_BAD_NAMETYPE (value 3 in the routine error field) is 3
516
The macros GSS_CALLING_ERROR(), GSS_ROUTINE_ERROR() and
517
GSS_SUPPLEMENTARY_INFO() are provided, each of which takes a GSS
518
status code and removes all but the relevant field. For example, the
519
value obtained by applying GSS_ROUTINE_ERROR to a status code removes
520
the calling errors and supplementary info fields, leaving only the
521
routine errors field. The values delivered by these macros may be
522
directly compared with a GSS_S_xxx symbol of the appropriate type.
523
The macro GSS_ERROR() is also provided, which when applied to a GSS
524
status code returns a non-zero value if the status code indicated a
525
calling or routine error, and a zero value otherwise.
527
A GSSAPI implementation may choose to signal calling errors in a
528
platform-specific manner instead of, or in addition to the routine
529
value; routine errors and supplementary info should be returned via
530
routine status values only.
532
2.1.9.2. Mechanism-specific status codes
534
GSSAPI routines return a minor_status parameter, which is used to
535
indicate specialized errors from the underlying security mechanism.
536
This parameter may contain a single mechanism-specific error,
537
indicated by a OM_uint32 value.
539
The minor_status parameter will always be set by a GSSAPI routine,
540
even if it returns a calling error or one of the generic API errors
541
indicated above as fatal, although other output parameters may remain
542
unset in such cases. However, output parameters that are expected to
543
return pointers to storage allocated by a routine must always set set
544
by the routine, even in the event of an error, although in such cases
545
the GSSAPI routine may elect to set the returned parameter value to
546
NULL to indicate that no storage was actually allocated. Any length
547
field associated with such pointers (as in a gss_buffer_desc
548
structure) should also be set to zero in such cases.
550
The GSS status code GSS_S_FAILURE is used to indicate that the
551
underlying mechanism detected an error for which no specific GSS
552
status code is defined. The mechanism status code will provide more
553
details about the error.
557
A name is used to identify a person or entity. GSSAPI authenticates
558
the relationship between a name and the entity claiming the name.
564
RFC 1509 GSSAPI - Overview and C bindings September 1993
567
Two distinct representations are defined for names:
569
(a) A printable form, for presentation to a user
571
(b) An internal form, for presentation at the API
573
The syntax of a printable name is defined by the GSSAPI
574
implementation, and may be dependent on local system configuration,
575
or on individual user preference. The internal form provides a
576
canonical representation of the name that is independent of
579
A given GSSAPI implementation may support names drawn from multiple
580
namespaces. In such an implementation, the internal form of the name
581
must include fields that identify the namespace from which the name
582
is drawn. The namespace from which a printable name is drawn is
583
specified by an accompanying object identifier.
585
Routines (gss_import_name and gss_display_name) are provided to
586
convert names between their printable representations and the
587
gss_name_t type. gss_import_name may support multiple syntaxes for
588
each supported namespace, allowing users the freedom to choose a
589
preferred name representation. gss_display_name should use an
590
implementation-chosen preferred syntax for each supported name-type.
592
Comparison of internal-form names is accomplished via the
593
gss_compare_names routine. This removes the need for the application
594
program to understand the syntaxes of the various printable names
595
that a given GSSAPI implementation may support.
597
Storage is allocated by routines that return gss_name_t values. A
598
procedure, gss_release_name, is provided to free storage associated
601
2.1.11. Channel Bindings
603
GSSAPI supports the use of user-specified tags to identify a given
604
context to the peer application. These tags are used to identify the
605
particular communications channel that carries the context. Channel
606
bindings are communicated to the GSSAPI using the following
620
RFC 1509 GSSAPI - Overview and C bindings September 1993
623
typedef struct gss_channel_bindings_struct {
624
OM_uint32 initiator_addrtype;
625
gss_buffer_desc initiator_address;
626
OM_uint32 acceptor_addrtype;
627
gss_buffer_desc acceptor_address;
628
gss_buffer_desc application_data;
629
} *gss_channel_bindings_t;
631
The initiator_addrtype and acceptor_addrtype fields denote the type
632
of addresses contained in the initiator_address and acceptor_address
633
buffers. The address type should be one of the following:
635
GSS_C_AF_UNSPEC Unspecified address type
636
GSS_C_AF_LOCAL Host-local address type
637
GSS_C_AF_INET DARPA Internet address type
638
GSS_C_AF_IMPLINK ARPAnet IMP address type (eg IP)
639
GSS_C_AF_PUP pup protocols (eg BSP) address type
640
GSS_C_AF_CHAOS MIT CHAOS protocol address type
641
GSS_C_AF_NS XEROX NS address type
642
GSS_C_AF_NBS nbs address type
643
GSS_C_AF_ECMA ECMA address type
644
GSS_C_AF_DATAKIT datakit protocols address type
645
GSS_C_AF_CCITT CCITT protocols (eg X.25)
646
GSS_C_AF_SNA IBM SNA address type
647
GSS_C_AF_DECnet DECnet address type
648
GSS_C_AF_DLI Direct data link interface address type
649
GSS_C_AF_LAT LAT address type
650
GSS_C_AF_HYLINK NSC Hyperchannel address type
651
GSS_C_AF_APPLETALK AppleTalk address type
652
GSS_C_AF_BSC BISYNC 2780/3780 address type
653
GSS_C_AF_DSS Distributed system services address type
654
GSS_C_AF_OSI OSI TP4 address type
656
GSS_C_AF_NULLADDR No address specified
658
Note that these name address families rather than specific addressing
659
formats. For address families that contain several alternative
660
address forms, the initiator_address and acceptor_address fields must
661
contain sufficient information to determine which address form is
662
used. When not otherwise specified, addresses should be specified in
665
Conceptually, the GSSAPI concatenates the initiator_addrtype,
666
initiator_address, acceptor_addrtype, acceptor_address and
667
application_data to form an octet string. The mechanism signs this
668
octet string, and binds the signature to the context establishment
669
token emitted by gss_init_sec_context. The same bindings are
670
presented by the context acceptor to gss_accept_sec_context, and a
676
RFC 1509 GSSAPI - Overview and C bindings September 1993
679
signature is calculated in the same way. The calculated signature is
680
compared with that found in the token, and if the signatures differ,
681
gss_accept_sec_context will return a GSS_S_BAD_BINDINGS error, and
682
the context will not be established. Some mechanisms may include the
683
actual channel binding data in the token (rather than just a
684
signature); applications should therefore not use confidential data
685
as channel-binding components. Individual mechanisms may impose
686
additional constraints on addresses and address types that may appear
687
in channel bindings. For example, a mechanism may verify that the
688
initiator_address field of the channel bindings presented to
689
gss_init_sec_context contains the correct network address of the host
692
2.1.12. Optional parameters
694
Various parameters are described as optional. This means that they
695
follow a convention whereby a default value may be requested. The
696
following conventions are used for omitted parameters. These
697
conventions apply only to those parameters that are explicitly
698
documented as optional.
700
2.1.12.1. gss_buffer_t types
702
Specify GSS_C_NO_BUFFER as a value. For an input parameter this
703
signifies that default behavior is requested, while for an output
704
parameter it indicates that the information that would be returned
705
via the parameter is not required by the application.
707
2.1.12.2. Integer types (input)
709
Individual parameter documentation lists values to be used to
710
indicate default actions.
712
2.1.12.3. Integer types (output)
714
Specify NULL as the value for the pointer.
716
2.1.12.4. Pointer types
718
Specify NULL as the value.
722
Specify GSS_C_NULL_OID as the value.
724
2.1.12.6. Object ID Sets
726
Specify GSS_C_NULL_OID_SET as the value.
732
RFC 1509 GSSAPI - Overview and C bindings September 1993
735
2.1.12.7. Credentials
737
Specify GSS_C_NO_CREDENTIAL to use the default credential handle.
739
2.1.12.8. Channel Bindings
741
Specify GSS_C_NO_CHANNEL_BINDINGS to indicate that channel bindings
744
3. GSSAPI routine descriptions
746
2.1. gss_acquire_cred
748
OM_uint32 gss_acquire_cred (
749
OM_uint32 * minor_status,
750
gss_name_t desired_name,
752
gss_OID_set desired_mechs,
754
gss_cred_id_t * output_cred_handle,
755
gss_OID_set * actual_mechs,
759
Allows an application to acquire a handle for a pre-existing
760
credential by name. GSSAPI implementations must impose a local
761
access-control policy on callers of this routine to prevent
762
unauthorized callers from acquiring credentials to which they are not
763
entitled. This routine is not intended to provide a "login to the
764
network" function, as such a function would result in the creation of
765
new credentials rather than merely acquiring a handle to existing
766
credentials. Such functions, if required, should be defined in
767
implementation-specific extensions to the API.
769
If credential acquisition is time-consuming for a mechanism, the
770
mechanism may chooses to delay the actual acquisition until the
771
credential is required (e.g., by gss_init_sec_context or
772
gss_accept_sec_context). Such mechanism-specific implementation
773
decisions should be invisible to the calling application; thus a call
774
of gss_inquire_cred immediately following the call of
775
gss_acquire_cred must return valid credential data, and may therefore
776
incur the overhead of a deferred credential acquisition.
780
desired_name gss_name_t, read
781
Name of principal whose credential
788
RFC 1509 GSSAPI - Overview and C bindings September 1993
791
time_req integer, read
792
number of seconds that credentials
795
desired_mechs Set of Object IDs, read
796
set of underlying security mechanisms that
797
may be used. GSS_C_NULL_OID_SET may be used
798
to obtain an implementation-specific default.
800
cred_usage integer, read
801
GSS_C_BOTH - Credentials may be used
802
either to initiate or accept
804
GSS_C_INITIATE - Credentials will only be
805
used to initiate security
807
GSS_C_ACCEPT - Credentials will only be used to
808
accept security contexts.
810
output_cred_handle gss_cred_id_t, modify
811
The returned credential handle.
813
actual_mechs Set of Object IDs, modify, optional
814
The set of mechanisms for which the
815
credential is valid. Specify NULL
818
time_rec Integer, modify, optional
819
Actual number of seconds for which the
820
returned credentials will remain valid. If the
821
implementation does not support expiration of
822
credentials, the value GSS_C_INDEFINITE will
823
be returned. Specify NULL if not required
825
minor_status Integer, modify
826
Mechanism specific status code.
831
GSS_S_COMPLETE Successful completion
833
GSS_S_BAD_MECH Unavailable mechanism requested
835
GSS_S_BAD_NAMETYPE Type contained within desired_name parameter is
838
GSS_S_BAD_NAME Value supplied for desired_name parameter is
844
RFC 1509 GSSAPI - Overview and C bindings September 1993
849
GSS_S_FAILURE Unspecified failure. The minor_status parameter
850
contains more detailed information
852
3.2. gss_release_cred
854
OM_uint32 gss_release_cred (
855
OM_uint32 * minor_status,
856
gss_cred_id_t * cred_handle)
860
Informs GSSAPI that the specified credential handle is no longer
861
required by the process. When all processes have released a
862
credential, it will be deleted.
866
cred_handle gss_cred_id_t, modify, optional
867
buffer containing opaque credential
868
handle. If GSS_C_NO_CREDENTIAL is supplied,
869
the default credential will be released
871
minor_status integer, modify
872
Mechanism specific status code.
878
GSS_S_COMPLETE Successful completion
880
GSS_S_NO_CRED Credentials could not be accessed.
900
RFC 1509 GSSAPI - Overview and C bindings September 1993
903
3.3. gss_init_sec_context
905
OM_uint32 gss_init_sec_context (
906
OM_uint32 * minor_status,
907
gss_cred_id_t claimant_cred_handle,
908
gss_ctx_id_t * context_handle,
909
gss_name_t target_name,
913
gss_channel_bindings_t
915
gss_buffer_t input_token
916
gss_OID * actual_mech_type,
917
gss_buffer_t output_token,
919
OM_uint32 * time_rec )
923
Initiates the establishment of a security context between the
924
application and a remote peer. Initially, the input_token parameter
925
should be specified as GSS_C_NO_BUFFER. The routine may return a
926
output_token which should be transferred to the peer application,
927
where the peer application will present it to gss_accept_sec_context.
928
If no token need be sent, gss_init_sec_context will indicate this by
929
setting the length field of the output_token argument to zero. To
930
complete the context establishment, one or more reply tokens may be
931
required from the peer application; if so, gss_init_sec_context will
932
return a status indicating GSS_S_CONTINUE_NEEDED in which case it
933
should be called again when the reply token is received from the peer
934
application, passing the token to gss_init_sec_context via the
935
input_token parameters.
937
The values returned via the ret_flags and time_rec parameters are not
938
defined unless the routine returns GSS_S_COMPLETE.
942
claimant_cred_handle gss_cred_id_t, read, optional
943
handle for credentials claimed. Supply
944
GSS_C_NO_CREDENTIAL to use default
947
context_handle gss_ctx_id_t, read/modify
948
context handle for new context. Supply
949
GSS_C_NO_CONTEXT for first call; use value
950
returned by first call in continuation calls.
956
RFC 1509 GSSAPI - Overview and C bindings September 1993
959
target_name gss_name_t, read
962
mech_type OID, read, optional
963
Object ID of desired mechanism. Supply
964
GSS_C_NULL_OID to obtain an implementation
967
req_flags bit-mask, read
968
Contains four independent flags, each of
969
which requests that the context support a
970
specific service option. Symbolic
971
names are provided for each flag, and the
972
symbolic names corresponding to the required
973
flags should be logically-ORed
974
together to form the bit-mask value. The
978
True - Delegate credentials to remote peer
979
False - Don't delegate
981
True - Request that remote peer
983
False - Authenticate self to remote peer
986
True - Enable replay detection for signed
988
False - Don't attempt to detect
991
True - Enable detection of out-of-sequence
992
signed or sealed messages
993
False - Don't attempt to detect
994
out-of-sequence messages
996
time_req integer, read
997
Desired number of seconds for which context
998
should remain valid. Supply 0 to request a
999
default validity period.
1001
input_chan_bindings channel bindings, read
1002
Application-specified bindings. Allows
1003
application to securely bind channel
1004
identification information to the security
1012
RFC 1509 GSSAPI - Overview and C bindings September 1993
1015
input_token buffer, opaque, read, optional (see text)
1016
Token received from peer application.
1017
Supply GSS_C_NO_BUFFER on initial call.
1019
actual_mech_type OID, modify
1020
actual mechanism used.
1022
output_token buffer, opaque, modify
1023
token to be sent to peer application. If
1024
the length field of the returned buffer is
1025
zero, no token need be sent to the peer
1028
ret_flags bit-mask, modify
1029
Contains six independent flags, each of which
1030
indicates that the context supports a specific
1031
service option. Symbolic names are provided
1032
for each flag, and the symbolic names
1033
corresponding to the required flags should be
1034
logically-ANDed with the ret_flags value to test
1035
whether a given option is supported by the
1036
context. The flags are:
1039
True - Credentials were delegated to
1041
False - No credentials were delegated
1043
True - Remote peer has been asked to
1044
authenticated itself
1045
False - Remote peer has not been asked to
1048
True - replay of signed or sealed messages
1050
False - replayed messages will not be
1053
True - out-of-sequence signed or sealed
1054
messages will be detected
1055
False - out-of-sequence messages will not
1058
True - Confidentiality service may be
1059
invoked by calling seal routine
1060
False - No confidentiality service (via
1061
seal) available. seal will provide
1062
message encapsulation, data-origin
1068
RFC 1509 GSSAPI - Overview and C bindings September 1993
1071
authentication and integrity
1074
True - Integrity service may be invoked by
1075
calling either gss_sign or gss_seal
1077
False - Per-message integrity service
1080
time_rec integer, modify, optional
1081
number of seconds for which the context
1082
will remain valid. If the implementation does
1083
not support credential expiration, the value
1084
GSS_C_INDEFINITE will be returned. Specify
1085
NULL if not required.
1087
minor_status integer, modify
1088
Mechanism specific status code.
1094
GSS_S_COMPLETE Successful completion
1096
GSS_S_CONTINUE_NEEDED Indicates that a token from the peer
1097
application is required to complete thecontext, and
1098
that gss_init_sec_context must be called again with
1101
GSS_S_DEFECTIVE_TOKEN Indicates that consistency checks performed on
1102
the input_token failed
1104
GSS_S_DEFECTIVE_CREDENTIAL Indicates that consistency checks
1105
performed on the credential failed.
1107
GSS_S_NO_CRED The supplied credentials were not valid for context
1108
initiation, or the credential handle did not
1109
reference any credentials.
1111
GSS_S_CREDENTIALS_EXPIRED The referenced credentials have expired
1113
GSS_S_BAD_BINDINGS The input_token contains different channel
1114
bindings to those specified via the
1115
input_chan_bindings parameter
1117
GSS_S_BAD_SIG The input_token contains an invalid signature, or a
1118
signature that could not be verified
1124
RFC 1509 GSSAPI - Overview and C bindings September 1993
1127
GSS_S_OLD_TOKEN The input_token was too old. This is a fatal error
1128
during context establishment
1130
GSS_S_DUPLICATE_TOKEN The input_token is valid, but is a duplicate of
1131
a token already processed. This is a fatal error
1132
during context establishment.
1134
GSS_S_NO_CONTEXT Indicates that the supplied context handle did not
1135
refer to a valid context
1137
GSS_S_BAD_NAMETYPE The provided target_name parameter contained an
1138
invalid or unsupported type of name
1140
GSS_S_BAD_NAME The provided target_name parameter was ill-formed.
1142
GSS_S_FAILURE Failure. See minor_status for more information
1144
3.4. gss_accept_sec_context
1146
OM_uint32 gss_accept_sec_context (
1147
OM_uint32 * minor_status,
1148
gss_ctx_id_t * context_handle,
1149
gss_cred_id_t verifier_cred_handle,
1150
gss_buffer_t input_token_buffer
1151
gss_channel_bindings_t
1152
input_chan_bindings,
1153
gss_name_t * src_name,
1154
gss_OID * mech_type,
1155
gss_buffer_t output_token,
1157
OM_uint32 * time_rec,
1158
gss_cred_id_t * delegated_cred_handle)
1162
Allows a remotely initiated security context between the application
1163
and a remote peer to be established. The routine may return a
1164
output_token which should be transferred to the peer application,
1165
where the peer application will present it to gss_init_sec_context.
1166
If no token need be sent, gss_accept_sec_context will indicate this
1167
by setting the length field of the output_token argument to zero. To
1168
complete the context establishment, one or more reply tokens may be
1169
required from the peer application; if so, gss_accept_sec_context
1170
will return a status flag of GSS_S_CONTINUE_NEEDED, in which case it
1171
should be called again when the reply token is received from the peer
1172
application, passing the token to gss_accept_sec_context via the
1173
input_token parameters.
1180
RFC 1509 GSSAPI - Overview and C bindings September 1993
1183
The values returned via the src_name, ret_flags, time_rec, and
1184
delegated_cred_handle parameters are not defined unless the routine
1185
returns GSS_S_COMPLETE.
1189
context_handle gss_ctx_id_t, read/modify
1190
context handle for new context. Supply
1191
GSS_C_NO_CONTEXT for first call; use value
1192
returned in subsequent calls.
1194
verifier_cred_handle gss_cred_id_t, read, optional
1195
Credential handle claimed by context
1197
Specify GSS_C_NO_CREDENTIAL to use default
1198
credentials. If GSS_C_NO_CREDENTIAL is
1199
specified, but the caller has no default
1200
credentials established, an
1201
implementation-defined default credential
1204
input_token_buffer buffer, opaque, read
1205
token obtained from remote application
1207
input_chan_bindings channel bindings, read
1208
Application-specified bindings. Allows
1209
application to securely bind channel
1210
identification information to the security
1213
src_name gss_name_t, modify, optional
1214
Authenticated name of context initiator.
1215
After use, this name should be deallocated by
1216
passing it to gss_release_name. If not required,
1219
mech_type Object ID, modify
1220
Security mechanism used. The returned
1221
OID value will be a pointer into static
1222
storage, and should be treated as read-only
1225
output_token buffer, opaque, modify
1226
Token to be passed to peer application. If the
1227
length field of the returned token buffer is 0,
1228
then no token need be passed to the peer
1236
RFC 1509 GSSAPI - Overview and C bindings September 1993
1239
ret_flags bit-mask, modify
1240
Contains six independent flags, each of
1241
which indicates that the context supports a
1242
specific service option. Symbolic names are
1243
provided for each flag, and the symbolic names
1244
corresponding to the required flags
1245
should be logically-ANDed with the ret_flags
1246
value to test whether a given option is
1247
supported by the context. The flags are:
1249
True - Delegated credentials are available
1250
via the delegated_cred_handle
1252
False - No credentials were delegated
1254
True - Remote peer asked for mutual
1256
False - Remote peer did not ask for mutual
1259
True - replay of signed or sealed messages
1261
False - replayed messages will not be
1264
True - out-of-sequence signed or sealed
1265
messages will be detected
1266
False - out-of-sequence messages will not
1269
True - Confidentiality service may be
1270
invoked by calling seal routine
1271
False - No confidentiality service (via
1272
seal) available. seal will
1273
provide message encapsulation,
1274
data-origin authentication and
1275
integrity services only.
1277
True - Integrity service may be invoked
1278
by calling either gss_sign or
1280
False - Per-message integrity service
1283
time_rec integer, modify, optional
1284
number of seconds for which the context
1285
will remain valid. Specify NULL if not required.
1292
RFC 1509 GSSAPI - Overview and C bindings September 1993
1295
delegated_cred_handle
1296
gss_cred_id_t, modify
1297
credential handle for credentials received from
1298
context initiator. Only valid if deleg_flag in
1301
minor_status integer, modify
1302
Mechanism specific status code.
1308
GSS_S_COMPLETE Successful completion
1310
GSS_S_CONTINUE_NEEDED Indicates that a token from the peer
1311
application is required to complete the context,
1312
and that gss_accept_sec_context must be called
1313
again with that token.
1315
GSS_S_DEFECTIVE_TOKEN Indicates that consistency checks
1316
performed on the input_token failed.
1318
GSS_S_DEFECTIVE_CREDENTIAL Indicates that consistency checks
1319
performed on the credential failed.
1321
GSS_S_NO_CRED The supplied credentials were not valid for
1322
context acceptance, or the credential handle
1323
did not reference any credentials.
1325
GSS_S_CREDENTIALS_EXPIRED The referenced credentials have
1328
GSS_S_BAD_BINDINGS The input_token contains different channel
1329
bindings to those specified via the
1330
input_chan_bindings parameter.
1332
GSS_S_NO_CONTEXT Indicates that the supplied context handle did
1333
not refer to a valid context.
1335
GSS_S_BAD_SIG The input_token contains an invalid signature.
1337
GSS_S_OLD_TOKEN The input_token was too old. This is a fatal
1338
error during context establishment.
1340
GSS_S_DUPLICATE_TOKEN The input_token is valid, but is a
1341
duplicate of a token already processed. This
1342
is a fatal error during context establishment.
1348
RFC 1509 GSSAPI - Overview and C bindings September 1993
1351
GSS_S_FAILURE Failure. See minor_status for more information.
1353
3.5. gss_process_context_token
1355
OM_uint32 gss_process_context_token (
1356
OM_uint32 * minor_status,
1357
gss_ctx_id_t context_handle,
1358
gss_buffer_t token_buffer)
1362
Provides a way to pass a token to the security service. Usually,
1363
tokens are associated either with context establishment (when they
1364
would be passed to gss_init_sec_context or gss_accept_sec_context) or
1365
with per-message security service (when they would be passed to
1366
gss_verify or gss_unseal). Occasionally, tokens may be received at
1367
other times, and gss_process_context_token allows such tokens to be
1368
passed to the underlying security service for processing. At
1369
present, such additional tokens may only be generated by
1370
gss_delete_sec_context. GSSAPI implementation may use this service
1371
to implement deletion of the security context.
1375
context_handle gss_ctx_id_t, read
1376
context handle of context on which token is to
1379
token_buffer buffer, opaque, read
1380
pointer to first byte of token to process
1382
minor_status integer, modify
1383
Implementation specific status code.
1389
GSS_S_COMPLETE Successful completion
1391
GSS_S_DEFECTIVE_TOKEN Indicates that consistency checks
1392
performed on the token failed
1394
GSS_S_FAILURE Failure. See minor_status for more information
1396
GSS_S_NO_CONTEXT The context_handle did not refer to a valid
1404
RFC 1509 GSSAPI - Overview and C bindings September 1993
1407
3.6. gss_delete_sec_context
1409
OM_uint32 gss_delete_sec_context (
1410
OM_uint32 * minor_status,
1411
gss_ctx_id_t * context_handle,
1412
gss_buffer_t output_token)
1416
Delete a security context. gss_delete_sec_context will delete the
1417
local data structures associated with the specified security context,
1418
and generate an output_token, which when passed to the peer
1419
gss_process_context_token will instruct it to do likewise. No
1420
further security services may be obtained using the context specified
1425
minor_status integer, modify
1426
Mechanism specific status code.
1428
context_handle gss_ctx_id_t, modify
1429
context handle identifying context to delete.
1431
output_token buffer, opaque, modify
1432
token to be sent to remote application to
1433
instruct it to also delete the context
1439
GSS_S_COMPLETE Successful completion
1441
GSS_S_FAILURE Failure, see minor_status for more information
1443
GSS_S_NO_CONTEXT No valid context was supplied
1445
3.7. gss_context_time
1447
OM_uint32 gss_context_time (
1448
OM_uint32 * minor_status,
1449
gss_ctx_id_t context_handle,
1450
OM_uint32 * time_rec)
1453
Determines the number of seconds for which the specified context will
1460
RFC 1509 GSSAPI - Overview and C bindings September 1993
1465
minor_status integer, modify
1466
Implementation specific status code.
1468
context_handle gss_ctx_id_t, read
1469
Identifies the context to be interrogated.
1471
time_rec integer, modify
1472
Number of seconds that the context will remain
1473
valid. If the context has already expired,
1474
zero will be returned.
1479
GSS_S_COMPLETE Successful completion
1481
GSS_S_CONTEXT_EXPIRED The context has already expired
1483
GSS_S_CREDENTIALS_EXPIRED The context is recognized, but
1484
associated credentials have expired
1486
GSS_S_NO_CONTEXT The context_handle parameter did not identify a
1491
OM_uint32 gss_sign (
1492
OM_uint32 * minor_status,
1493
gss_ctx_id_t context_handle,
1495
gss_buffer_t message_buffer,
1496
gss_buffer_t msg_token)
1499
Generates a cryptographic signature for the supplied message, and
1500
places the signature in a token for transfer to the peer application.
1501
The qop_req parameter allows a choice between several cryptographic
1502
algorithms, if supported by the chosen mechanism.
1506
minor_status integer, modify
1507
Implementation specific status code.
1509
context_handle gss_ctx_id_t, read
1510
identifies the context on which the message
1516
RFC 1509 GSSAPI - Overview and C bindings September 1993
1521
qop_req integer, read, optional
1522
Specifies requested quality of protection.
1523
Callers are encouraged, on portability grounds,
1524
to accept the default quality of protection
1525
offered by the chosen mechanism, which may be
1526
requested by specifying GSS_C_QOP_DEFAULT for
1527
this parameter. If an unsupported protection
1528
strength is requested, gss_sign will return a
1529
major_status of GSS_S_FAILURE.
1531
message_buffer buffer, opaque, read
1532
message to be signed
1534
msg_token buffer, opaque, modify
1535
buffer to receive token
1541
GSS_S_COMPLETE Successful completion
1543
GSS_S_CONTEXT_EXPIRED The context has already expired
1545
GSS_S_CREDENTIALS_EXPIRED The context is recognized, but
1546
associated credentials have expired
1548
GSS_S_NO_CONTEXT The context_handle parameter did not identify a
1551
GSS_S_FAILURE Failure. See minor_status for more information.
1555
OM_uint32 gss_verify (
1556
OM_uint32 * minor_status,
1557
gss_ctx_id_t context_handle,
1558
gss_buffer_t message_buffer,
1559
gss_buffer_t token_buffer,
1563
Verifies that a cryptographic signature, contained in the token
1564
parameter, fits the supplied message. The qop_state parameter allows
1565
a message recipient to determine the strength of protection that was
1566
applied to the message.
1572
RFC 1509 GSSAPI - Overview and C bindings September 1993
1577
minor_status integer, modify
1578
Mechanism specific status code.
1580
context_handle gss_ctx_id_t, read
1581
identifies the context on which the message
1584
message_buffer buffer, opaque, read
1585
message to be verified
1587
token_buffer buffer, opaque, read
1588
token associated with message
1590
qop_state integer, modify
1591
quality of protection gained from signature
1597
GSS_S_COMPLETE Successful completion
1599
GSS_S_DEFECTIVE_TOKEN The token failed consistency checks
1601
GSS_S_BAD_SIG The signature was incorrect
1603
GSS_S_DUPLICATE_TOKEN The token was valid, and contained a correct
1604
signature for the message, but it had already
1607
GSS_S_OLD_TOKEN The token was valid, and contained a correct
1608
signature for the message, but it is too old
1610
GSS_S_UNSEQ_TOKEN The token was valid, and contained a correct
1611
signature for the message, but has been
1612
verified out of sequence; an earlier token has
1613
been signed or sealed by the remote
1614
application, but not yet been processed
1617
GSS_S_CONTEXT_EXPIRED The context has already expired
1619
GSS_S_CREDENTIALS_EXPIRED The context is recognized, but
1620
associated credentials have expired
1628
RFC 1509 GSSAPI - Overview and C bindings September 1993
1631
GSS_S_NO_CONTEXT The context_handle parameter did not identify a
1634
GSS_S_FAILURE Failure. See minor_status for more information.
1638
OM_uint32 gss_seal (
1639
OM_uint32 * minor_status,
1640
gss_ctx_id_t context_handle,
1643
gss_buffer_t input_message_buffer,
1645
gss_buffer_t output_message_buffer)
1649
Cryptographically signs and optionally encrypts the specified
1650
input_message. The output_message contains both the signature and
1651
the message. The qop_req parameter allows a choice between several
1652
cryptographic algorithms, if supported by the chosen mechanism.
1656
minor_status integer, modify
1657
Mechanism specific status code.
1659
context_handle gss_ctx_id_t, read
1660
identifies the context on which the message
1663
conf_req_flag boolean, read
1664
True - Both confidentiality and integrity
1665
services are requested
1666
False - Only integrity service is requested
1668
qop_req integer, read, optional
1669
Specifies required quality of protection. A
1670
mechanism-specific default may be requested by
1671
setting qop_req to GSS_C_QOP_DEFAULT. If an
1672
unsupported protection strength is requested,
1673
gss_seal will return a major_status of
1676
input_message_buffer buffer, opaque, read
1677
message to be sealed
1684
RFC 1509 GSSAPI - Overview and C bindings September 1993
1687
conf_state boolean, modify
1688
True - Confidentiality, data origin
1689
authentication and integrity services
1691
False - Integrity and data origin services only
1694
output_message_buffer buffer, opaque, modify
1695
buffer to receive sealed message
1701
GSS_S_COMPLETE Successful completion
1703
GSS_S_CONTEXT_EXPIRED The context has already expired
1705
GSS_S_CREDENTIALS_EXPIRED The context is recognized, but
1706
associated credentials have expired
1708
GSS_S_NO_CONTEXT The context_handle parameter did not identify a
1711
GSS_S_FAILURE Failure. See minor_status for more information.
1715
OM_uint32 gss_unseal (
1716
OM_uint32 * minor_status,
1717
gss_ctx_id_t context_handle,
1718
gss_buffer_t input_message_buffer,
1719
gss_buffer_t output_message_buffer,
1725
Converts a previously sealed message back to a usable form, verifying
1726
the embedded signature. The conf_state parameter indicates whether
1727
the message was encrypted; the qop_state parameter indicates the
1728
strength of protection that was used to provide the confidentiality
1729
and integrity services.
1733
minor_status integer, modify
1734
Mechanism specific status code.
1740
RFC 1509 GSSAPI - Overview and C bindings September 1993
1743
context_handle gss_ctx_id_t, read
1744
identifies the context on which the message
1747
input_message_buffer buffer, opaque, read
1750
output_message_buffer buffer, opaque, modify
1751
buffer to receive unsealed message
1753
conf_state boolean, modify
1754
True - Confidentiality and integrity protection
1756
False - Inteegrity service only was used
1758
qop_state integer, modify
1759
quality of protection gained from signature
1765
GSS_S_COMPLETE Successful completion
1767
GSS_S_DEFECTIVE_TOKEN The token failed consistency checks
1769
GSS_S_BAD_SIG The signature was incorrect
1771
GSS_S_DUPLICATE_TOKEN The token was valid, and contained a
1772
correct signature for the message, but it had
1773
already been processed
1775
GSS_S_OLD_TOKEN The token was valid, and contained a correct
1776
signature for the message, but it is too old
1778
GSS_S_UNSEQ_TOKEN The token was valid, and contained a correct
1779
signature for the message, but has been
1780
verified out of sequence; an earlier token has
1781
been signed or sealed by the remote
1782
application, but not yet been processed
1785
GSS_S_CONTEXT_EXPIRED The context has already expired
1787
GSS_S_CREDENTIALS_EXPIRED The context is recognized, but
1788
associated credentials have expired
1796
RFC 1509 GSSAPI - Overview and C bindings September 1993
1799
GSS_S_NO_CONTEXT The context_handle parameter did not identify a
1802
GSS_S_FAILURE Failure. See minor_status for more information.
1804
3.12. gss_display_status
1806
OM_uint32 gss_display_status (
1807
OM_uint32 * minor_status,
1811
int * message_context,
1812
gss_buffer_t status_string)
1816
Allows an application to obtain a textual representation of a GSSAPI
1817
status code, for display to the user or for logging purposes. Since
1818
some status values may indicate multiple errors, applications may
1819
need to call gss_display_status multiple times, each call generating
1820
a single text string. The message_context parameter is used to
1821
indicate which error message should be extracted from a given
1822
status_value; message_context should be initialized to 0, and
1823
gss_display_status will return a non-zero value if there are further
1824
messages to extract.
1828
minor_status integer, modify
1829
Mechanism specific status code.
1831
status_value integer, read
1832
Status value to be converted
1834
status_type integer, read
1835
GSS_C_GSS_CODE - status_value is a GSS status
1837
GSS_C_MECH_CODE - status_value is a mechanism
1840
mech_type Object ID, read, optional
1841
Underlying mechanism (used to interpret a
1842
minor status value) Supply GSS_C_NULL_OID to
1843
obtain the system default.
1845
message_context integer, read/modify
1846
Should be initialized to zero by caller
1852
RFC 1509 GSSAPI - Overview and C bindings September 1993
1855
on first call. If further messages are
1856
contained in the status_value parameter,
1857
message_context will be non-zero on return,
1858
and this value should be passed back to
1859
subsequent calls, along with the same
1860
status_value, status_type and mech_type
1863
status_string buffer, character string, modify
1864
textual interpretation of the status_value
1870
GSS_S_COMPLETE Successful completion
1872
GSS_S_BAD_MECH Indicates that translation in accordance with
1873
an unsupported mechanism type was requested
1875
GSS_S_BAD_STATUS The status value was not recognized, or the
1876
status type was neither GSS_C_GSS_CODE nor
1880
3.13. gss_indicate_mechs
1882
OM_uint32 gss_indicate_mechs (
1883
OM_uint32 * minor_status,
1884
gss_OID_set * mech_set)
1888
Allows an application to determine which underlying security
1889
mechanisms are available.
1893
minor_status integer, modify
1894
Mechanism specific status code.
1896
mech_set set of Object IDs, modify
1897
set of implementation-supported mechanisms.
1898
The returned gss_OID_set value will be a
1899
pointer into static storage, and should be
1900
treated as read-only by the caller.
1908
RFC 1509 GSSAPI - Overview and C bindings September 1993
1915
GSS_S_COMPLETE Successful completion
1917
3.14. gss_compare_name
1919
OM_uint32 gss_compare_name (
1920
OM_uint32 * minor_status,
1927
Allows an application to compare two internal-form names to determine
1928
whether they refer to the same entity.
1932
minor_status integer, modify
1933
Mechanism specific status code.
1935
name1 gss_name_t, read
1938
name2 gss_name_t, read
1941
name_equal boolean, modify
1942
True - names refer to same entity
1943
False - names refer to different entities
1944
(strictly, the names are not known to
1945
refer to the same identity).
1950
GSS_S_COMPLETE Successful completion
1952
GSS_S_BAD_NAMETYPE The type contained within either name1 or
1953
name2 was unrecognized, or the names were of
1956
GSS_S_BAD_NAME One or both of name1 or name2 was ill-formed
1964
RFC 1509 GSSAPI - Overview and C bindings September 1993
1967
3.15. gss_display_name
1969
OM_uint32 gss_display_name (
1970
OM_uint32 * minor_status,
1971
gss_name_t input_name,
1972
gss_buffer_t output_name_buffer,
1973
gss_OID * output_name_type)
1977
Allows an application to obtain a textual representation of an opaque
1978
internal-form name for display purposes. The syntax of a printable
1979
name is defined by the GSSAPI implementation.
1983
minor_status integer, modify
1984
Mechanism specific status code.
1986
input_name gss_name_t, read
1987
name to be displayed
1989
output_name_buffer buffer, character-string, modify
1990
buffer to receive textual name string
1992
output_name_type Object ID, modify
1993
The type of the returned name. The returned
1994
gss_OID will be a pointer into static storage,
1995
and should be treated as read-only by the caller
2001
GSS_S_COMPLETE Successful completion
2003
GSS_S_BAD_NAMETYPE The type of input_name was not recognized
2005
GSS_S_BAD_NAME input_name was ill-formed
2007
3.16. gss_import_name
2009
OM_uint32 gss_import_name (
2010
OM_uint32 * minor_status,
2011
gss_buffer_t input_name_buffer,
2012
gss_OID input_name_type,
2013
gss_name_t * output_name)
2020
RFC 1509 GSSAPI - Overview and C bindings September 1993
2025
Convert a printable name to internal form.
2029
minor_status integer, modify
2030
Mechanism specific status code
2032
input_name_buffer buffer, character-string, read
2033
buffer containing printable name to convert
2035
input_name_type Object ID, read, optional
2036
Object Id specifying type of printable
2037
name. Applications may specify either
2038
GSS_C_NULL_OID to use a local system-specific
2039
printable syntax, or an OID registered by the
2040
GSSAPI implementation to name a particular
2043
output_name gss_name_t, modify
2044
returned name in internal form
2050
GSS_S_COMPLETE Successful completion
2052
GSS_S_BAD_NAMETYPE The input_name_type was unrecognized
2054
GSS_S_BAD_NAME The input_name parameter could not be
2055
interpreted as a name of the specified type
2057
3.17. gss_release_name
2059
OM_uint32 gss_release_name (
2060
OM_uint32 * minor_status,
2065
Free GSSAPI-allocated storage associated with an internal form name.
2069
minor_status integer, modify
2070
Mechanism specific status code
2076
RFC 1509 GSSAPI - Overview and C bindings September 1993
2079
name gss_name_t, modify
2080
The name to be deleted
2086
GSS_S_COMPLETE Successful completion
2088
GSS_S_BAD_NAME The name parameter did not contain a valid name
2090
3.18. gss_release_buffer
2092
OM_uint32 gss_release_buffer (
2093
OM_uint32 * minor_status,
2094
gss_buffer_t buffer)
2098
Free storage associated with a buffer format name. The storage must
2099
have been allocated by a GSSAPI routine. In addition to freeing the
2100
associated storage, the routine will zero the length field in the
2105
minor_status integer, modify
2106
Mechanism specific status code
2108
buffer buffer, modify
2109
The storage associated with the buffer will be
2110
deleted. The gss_buffer_desc object will not
2111
be freed, but its length field will be zeroed.
2117
GSS_S_COMPLETE Successful completion
2119
3.19. gss_release_oid_set
2121
OM_uint32 gss_release_oid_set (
2122
OM_uint32 * minor_status,
2132
RFC 1509 GSSAPI - Overview and C bindings September 1993
2135
Free storage associated with a gss_OID_set object. The storage must
2136
have been allocated by a GSSAPI routine.
2140
minor_status integer, modify
2141
Mechanism specific status code
2143
set Set of Object IDs, modify
2144
The storage associated with the gss_OID_set
2151
GSS_S_COMPLETE Successful completion
2153
3.20. gss_inquire_cred
2155
OM_uint32 gss_inquire_cred (
2156
OM_uint32 * minor_status,
2157
gss_cred_id_t cred_handle,
2159
OM_uint32 * lifetime,
2161
gss_OID_set * mechanisms )
2165
Obtains information about a credential. The caller must already have
2166
obtained a handle that refers to the credential.
2170
minor_status integer, modify
2171
Mechanism specific status code
2173
cred_handle gss_cred_id_t, read
2174
A handle that refers to the target credential.
2175
Specify GSS_C_NO_CREDENTIAL to inquire about
2176
the default credential.
2178
name gss_name_t, modify
2179
The name whose identity the credential asserts.
2180
Specify NULL if not required.
2182
lifetime Integer, modify
2188
RFC 1509 GSSAPI - Overview and C bindings September 1993
2191
The number of seconds for which the credential
2192
will remain valid. If the credential has
2193
expired, this parameter will be set to zero.
2194
If the implementation does not support
2195
credential expiration, the value
2196
GSS_C_INDEFINITE will be returned. Specify
2197
NULL if not required.
2199
cred_usage Integer, modify
2200
How the credential may be used. One of the
2205
Specify NULL if not required.
2207
mechanisms gss_OID_set, modify
2208
Set of mechanisms supported by the credential.
2209
Specify NULL if not required.
2215
GSS_S_COMPLETE Successful completion
2217
GSS_S_NO_CRED The referenced credentials could not be
2220
GSS_S_DEFECTIVE_CREDENTIAL The referenced credentials were
2223
GSS_S_CREDENTIALS_EXPIRED The referenced credentials have expired.
2224
If the lifetime parameter was not passed as
2225
NULL, it will be set to 0.
2232
* First, define the platform-dependent types.
2234
typedef <platform-specific> OM_uint32;
2235
typedef <platform-specific> gss_ctx_id_t;
2236
typedef <platform-specific> gss_cred_id_t;
2237
typedef <platform-specific> gss_name_t;
2244
RFC 1509 GSSAPI - Overview and C bindings September 1993
2248
* Note that a platform supporting the xom.h X/Open header file
2249
* may make use of that header for the definitions of OM_uint32
2250
* and the structure to which gss_OID_desc equates.
2253
typedef struct gss_OID_desc_struct {
2256
} gss_OID_desc, *gss_OID;
2258
typedef struct gss_OID_set_desc_struct {
2261
} gss_OID_set_desc, *gss_OID_set;
2263
typedef struct gss_buffer_desc_struct {
2266
} gss_buffer_desc, *gss_buffer_t;
2268
typedef struct gss_channel_bindings_struct {
2269
OM_uint32 initiator_addrtype;
2270
gss_buffer_desc initiator_address;
2271
OM_uint32 acceptor_addrtype;
2272
gss_buffer_desc acceptor_address;
2273
gss_buffer_desc application_data;
2274
} *gss_channel_bindings_t;
2278
* Six independent flags each of which indicates that a context
2279
* supports a specific service option.
2281
#define GSS_C_DELEG_FLAG 1
2282
#define GSS_C_MUTUAL_FLAG 2
2283
#define GSS_C_REPLAY_FLAG 4
2284
#define GSS_C_SEQUENCE_FLAG 8
2285
#define GSS_C_CONF_FLAG 16
2286
#define GSS_C_INTEG_FLAG 32
2290
* Credential usage options
2292
#define GSS_C_BOTH 0
2293
#define GSS_C_INITIATE 1
2294
#define GSS_C_ACCEPT 2
2300
RFC 1509 GSSAPI - Overview and C bindings September 1993
2304
* Status code types for gss_display_status
2306
#define GSS_C_GSS_CODE 1
2307
#define GSS_C_MECH_CODE 2
2310
* The constant definitions for channel-bindings address families
2312
#define GSS_C_AF_UNSPEC 0;
2313
#define GSS_C_AF_LOCAL 1;
2314
#define GSS_C_AF_INET 2;
2315
#define GSS_C_AF_IMPLINK 3;
2316
#define GSS_C_AF_PUP 4;
2317
#define GSS_C_AF_CHAOS 5;
2318
#define GSS_C_AF_NS 6;
2319
#define GSS_C_AF_NBS 7;
2320
#define GSS_C_AF_ECMA 8;
2321
#define GSS_C_AF_DATAKIT 9;
2322
#define GSS_C_AF_CCITT 10;
2323
#define GSS_C_AF_SNA 11;
2324
#define GSS_C_AF_DECnet 12;
2325
#define GSS_C_AF_DLI 13;
2326
#define GSS_C_AF_LAT 14;
2327
#define GSS_C_AF_HYLINK 15;
2328
#define GSS_C_AF_APPLETALK 16;
2329
#define GSS_C_AF_BSC 17;
2330
#define GSS_C_AF_DSS 18;
2331
#define GSS_C_AF_OSI 19;
2332
#define GSS_C_AF_X25 21;
2334
#define GSS_C_AF_NULLADDR 255;
2336
#define GSS_C_NO_BUFFER ((gss_buffer_t) 0)
2337
#define GSS_C_NULL_OID ((gss_OID) 0)
2338
#define GSS_C_NULL_OID_SET ((gss_OID_set) 0)
2339
#define GSS_C_NO_CONTEXT ((gss_ctx_id_t) 0)
2340
#define GSS_C_NO_CREDENTIAL ((gss_cred_id_t) 0)
2341
#define GSS_C_NO_CHANNEL_BINDINGS ((gss_channel_bindings_t) 0)
2342
#define GSS_C_EMPTY_BUFFER {0, NULL}
2345
* Define the default Quality of Protection for per-message
2346
* services. Note that an implementation that offers multiple
2347
* levels of QOP may either reserve a value (for example zero,
2348
* as assumed here) to mean "default protection", or alternatively
2349
* may simply equate GSS_C_QOP_DEFAULT to a specific explicit QOP
2356
RFC 1509 GSSAPI - Overview and C bindings September 1993
2360
#define GSS_C_QOP_DEFAULT 0
2363
* Expiration time of 2^32-1 seconds means infinite lifetime for a
2364
* credential or security context
2366
#define GSS_C_INDEFINITE 0xfffffffful
2369
/* Major status codes */
2371
#define GSS_S_COMPLETE 0
2374
* Some "helper" definitions to make the status code macros obvious.
2376
#define GSS_C_CALLING_ERROR_OFFSET 24
2377
#define GSS_C_ROUTINE_ERROR_OFFSET 16
2378
#define GSS_C_SUPPLEMENTARY_OFFSET 0
2379
#define GSS_C_CALLING_ERROR_MASK 0377ul
2380
#define GSS_C_ROUTINE_ERROR_MASK 0377ul
2381
#define GSS_C_SUPPLEMENTARY_MASK 0177777ul
2384
* The macros that test status codes for error conditions
2386
#define GSS_CALLING_ERROR(x) \
2387
(x & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET))
2388
#define GSS_ROUTINE_ERROR(x) \
2389
(x & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))
2390
#define GSS_SUPPLEMENTARY_INFO(x) \
2391
(x & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET))
2392
#define GSS_ERROR(x) \
2393
((GSS_CALLING_ERROR(x) != 0) || (GSS_ROUTINE_ERROR(x) != 0))
2397
* Now the actual status code definitions
2403
#define GSS_S_CALL_INACCESSIBLE_READ \
2404
(1ul << GSS_C_CALLING_ERROR_OFFSET)
2405
#define GSS_S_CALL_INACCESSIBLE_WRITE \
2406
(2ul << GSS_C_CALLING_ERROR_OFFSET)
2412
RFC 1509 GSSAPI - Overview and C bindings September 1993
2415
#define GSS_S_CALL_BAD_STRUCTURE \
2416
(3ul << GSS_C_CALLING_ERROR_OFFSET)
2421
#define GSS_S_BAD_MECH (1ul << GSS_C_ROUTINE_ERROR_OFFSET)
2422
#define GSS_S_BAD_NAME (2ul << GSS_C_ROUTINE_ERROR_OFFSET)
2423
#define GSS_S_BAD_NAMETYPE (3ul << GSS_C_ROUTINE_ERROR_OFFSET)
2424
#define GSS_S_BAD_BINDINGS (4ul << GSS_C_ROUTINE_ERROR_OFFSET)
2425
#define GSS_S_BAD_STATUS (5ul << GSS_C_ROUTINE_ERROR_OFFSET)
2426
#define GSS_S_BAD_SIG (6ul << GSS_C_ROUTINE_ERROR_OFFSET)
2427
#define GSS_S_NO_CRED (7ul << GSS_C_ROUTINE_ERROR_OFFSET)
2428
#define GSS_S_NO_CONTEXT (8ul << GSS_C_ROUTINE_ERROR_OFFSET)
2429
#define GSS_S_DEFECTIVE_TOKEN (9ul << GSS_C_ROUTINE_ERROR_OFFSET)
2430
#define GSS_S_DEFECTIVE_CREDENTIAL (10ul << GSS_C_ROUTINE_ERROR_OFFSET)
2431
#define GSS_S_CREDENTIALS_EXPIRED (11ul << GSS_C_ROUTINE_ERROR_OFFSET)
2432
#define GSS_S_CONTEXT_EXPIRED (12ul << GSS_C_ROUTINE_ERROR_OFFSET)
2433
#define GSS_S_FAILURE (13ul << GSS_C_ROUTINE_ERROR_OFFSET)
2436
* Supplementary info bits:
2438
#define GSS_S_CONTINUE_NEEDED (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 0))
2439
#define GSS_S_DUPLICATE_TOKEN (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 1))
2440
#define GSS_S_OLD_TOKEN (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 2))
2441
#define GSS_S_UNSEQ_TOKEN (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 3))
2445
* Finally, function prototypes for the GSSAPI routines.
2448
OM_uint32 gss_acquire_cred
2449
(OM_uint32*, /* minor_status */
2450
gss_name_t, /* desired_name */
2451
OM_uint32, /* time_req */
2452
gss_OID_set, /* desired_mechs */
2453
int, /* cred_usage */
2454
gss_cred_id_t*, /* output_cred_handle */
2455
gss_OID_set*, /* actual_mechs */
2456
OM_uint32* /* time_rec */
2459
OM_uint32 gss_release_cred,
2460
(OM_uint32*, /* minor_status */
2461
gss_cred_id_t* /* cred_handle */
2468
RFC 1509 GSSAPI - Overview and C bindings September 1993
2471
OM_uint32 gss_init_sec_context
2472
(OM_uint32*, /* minor_status */
2473
gss_cred_id_t, /* claimant_cred_handle */
2474
gss_ctx_id_t*, /* context_handle */
2475
gss_name_t, /* target_name */
2476
gss_OID, /* mech_type */
2477
int, /* req_flags */
2478
OM_uint32, /* time_req */
2479
gss_channel_bindings_t,
2480
/* input_chan_bindings */
2481
gss_buffer_t, /* input_token */
2482
gss_OID*, /* actual_mech_type */
2483
gss_buffer_t, /* output_token */
2484
int*, /* ret_flags */
2485
OM_uint32* /* time_rec */
2488
OM_uint32 gss_accept_sec_context
2489
(OM_uint32*, /* minor_status */
2490
gss_ctx_id_t*, /* context_handle */
2491
gss_cred_id_t, /* verifier_cred_handle */
2492
gss_buffer_t, /* input_token_buffer */
2493
gss_channel_bindings_t,
2494
/* input_chan_bindings */
2495
gss_name_t*, /* src_name */
2496
gss_OID*, /* mech_type */
2497
gss_buffer_t, /* output_token */
2498
int*, /* ret_flags */
2499
OM_uint32*, /* time_rec */
2500
gss_cred_id_t* /* delegated_cred_handle */
2503
OM_uint32 gss_process_context_token
2504
(OM_uint32*, /* minor_status */
2505
gss_ctx_id_t, /* context_handle */
2506
gss_buffer_t /* token_buffer */
2509
OM_uint32 gss_delete_sec_context
2510
(OM_uint32*, /* minor_status */
2511
gss_ctx_id_t*, /* context_handle */
2512
gss_buffer_t /* output_token */
2524
RFC 1509 GSSAPI - Overview and C bindings September 1993
2527
OM_uint32 gss_context_time
2528
(OM_uint32*, /* minor_status */
2529
gss_ctx_id_t, /* context_handle */
2530
OM_uint32* /* time_rec */
2534
(OM_uint32*, /* minor_status */
2535
gss_ctx_id_t, /* context_handle */
2537
gss_buffer_t, /* message_buffer */
2538
gss_buffer_t /* message_token */
2541
OM_uitn32 gss_verify
2542
(OM_uint32*, /* minor_status */
2543
gss_ctx_id_t, /* context_handle */
2544
gss_buffer_t, /* message_buffer */
2545
gss_buffer_t, /* token_buffer */
2546
int* /* qop_state */
2550
(OM_uint32*, /* minor_status */
2551
gss_ctx_id_t, /* context_handle */
2552
int, /* conf_req_flag */
2554
gss_buffer_t, /* input_message_buffer */
2555
int*, /* conf_state */
2556
gss_buffer_t /* output_message_buffer */
2559
OM_uint32 gss_unseal
2560
(OM_uint32*, /* minor_status */
2561
gss_ctx_id_t, /* context_handle */
2562
gss_buffer_t, /* input_message_buffer */
2563
gss_buffer_t, /* output_message_buffer */
2564
int*, /* conf_state */
2565
int* /* qop_state */
2580
RFC 1509 GSSAPI - Overview and C bindings September 1993
2583
OM_uint32 gss_display_status
2584
(OM_uint32*, /* minor_status */
2585
OM_uint32, /* status_value */
2586
int, /* status_type */
2587
gss_OID, /* mech_type */
2588
int*, /* message_context */
2589
gss_buffer_t /* status_string */
2592
OM_uint32 gss_indicate_mechs
2593
(OM_uint32*, /* minor_status */
2594
gss_OID_set* /* mech_set */
2597
OM_uint32 gss_compare_name
2598
(OM_uint32*, /* minor_status */
2599
gss_name_t, /* name1 */
2600
gss_name_t, /* name2 */
2601
int* /* name_equal */
2604
OM_uint32 gss_display_name,
2605
(OM_uint32*, /* minor_status */
2606
gss_name_t, /* input_name */
2607
gss_buffer_t, /* output_name_buffer */
2608
gss_OID* /* output_name_type */
2611
OM_uint32 gss_import_name
2612
(OM_uint32*, /* minor_status */
2613
gss_buffer_t, /* input_name_buffer */
2614
gss_OID, /* input_name_type */
2615
gss_name_t* /* output_name */
2618
OM_uint32 gss_release_name
2619
(OM_uint32*, /* minor_status */
2620
gss_name_t* /* input_name */
2623
OM_uint32 gss_release_buffer
2624
(OM_uint32*, /* minor_status */
2625
gss_buffer_t /* buffer */
2628
OM_uint32 gss_release_oid_set
2629
(OM_uint32*, /* minor_status */
2630
gss_OID_set* /* set */
2636
RFC 1509 GSSAPI - Overview and C bindings September 1993
2641
OM_uint32 gss_inquire_cred
2642
(OM_uint32 *, /* minor_status */
2643
gss_cred_id_t, /* cred_handle */
2644
gss_name_t *, /* name */
2645
OM_uint32 *, /* lifetime */
2646
int *, /* cred_usage */
2647
gss_OID_set * /* mechanisms */
2652
#endif /* GSSAPI_H_ */
2656
[1] Linn, J., "Generic Security Service Application Program
2657
Interface", RFC 1508, Geer Zolot Associate, September 1993.
2659
[2] "OSI Object Management API Specification, Version 2.0 t", X.400
2660
API Association & X/Open Company Limited, August 24, 1990.
2661
Specification of datatypes and routines for manipulating
2662
information objects.
2664
Security Considerations
2666
Security issues are discussed throughout this memo.
2671
Digital Equipment Corporation
2672
550 King Street, LKG2-2/AA6
2676
Phone: +1-508-486-5210
2677
EMail: Wray@tuxedo.enet.dec.com
b'\\ No newline at end of file'