rfc-6339

Context Token Encapsulate/Decapsulate and OID Comparison Functions for the Generic Security Service Application Program Interface (GSS-API)

S. Josefsson, L. Hornquist Astrand
date2011-08 streamIETF wgnon working group statusPROPOSED STANDARD pages8 canonicalhttps://www.rfc-editor.org/rfc/rfc6339 doi10.17487/RFC6339
This document describes three abstract Generic Security Service Application Program Interface (GSS-API) interfaces used to encapsulate/decapsulate context tokens and compare OIDs. This document also specifies C bindings for the abstract interfaces. [STANDARDS-TRACK]

Extracted elements (15)

design-rationale §2

The C bindings use the types gss_const_buffer_t and gss_const_OID from RFC 5587 to address a 'const' problem present in earlier versions of the specification, ensuring const-correctness for read-only parameters without requiring anything else from RFC 5587.

security

design-rationale §1

These three interfaces were added because protocols such as SASL GS2 (RFC 5801) need to programmatically add and remove the mechanism-independent GSS-API token header (ASN.1 tags, length, OID), and OID comparison is needed to validate that a negotiated mechanism matches the requested one. Prior to this document, GSS-API libraries lacked standard APIs for these operations.

security

interoperability-note §5

GSS_C_NO_OID passed to GSS_OID_equal() will not match any OID, including another GSS_C_NO_OID. Callers must not rely on GSS_C_NO_OID equality behavior when validating negotiated mechanisms.

security

interoperability-note §4

GSS_Decapsulate_token() returns GSS_S_DEFECTIVE_TOKEN when the encapsulated token fails consistency checks such as an OID mismatch between the token header and the expected token_oid, or ASN.1 DER length field errors, distinguishing these from generic failures.

security

normative-requirement §3.1 MUST

The caller of gss_encapsulate_token() and gss_decapsulate_token() MUST release the output_token buffer with gss_release_buffer() after use.

security

protocol-element §4

GSS_Decapsulate_token() removes the mechanism-independent token header from an initial GSS-API context token, validating the OID and ASN.1 DER structure. Returns GSS_S_COMPLETE, GSS_S_DEFECTIVE_TOKEN (OID mismatch or ASN.1 DER length errors), or GSS_S_FAILURE.

security

protocol-element §3

GSS_Encapsulate_token() adds the mechanism-independent token header (ASN.1 tags, length, and mechanism OID) to GSS-API context token data, returning the encapsulated token or GSS_S_FAILURE on error. The caller must release the output buffer with GSS_Release_buffer().

security

protocol-element §5

GSS_OID_equal() compares two OIDs for equality, returning non-zero when neither OID is GSS_C_NO_OID and the two OIDs are equal, and zero otherwise. GSS_C_NO_OID does not match any OID, including itself.

security

protocol-element §4.1

The C binding gss_decapsulate_token() takes a gss_const_buffer_t input_token and gss_const_OID token_oid (the expected OID), and writes the decapsulated data into a gss_buffer_t output_token. Returns OM_uint32 status codes including GSS_S_DEFECTIVE_TOKEN when consistency checks fail.

security

protocol-element §3.1

The C binding gss_encapsulate_token() takes a gss_const_buffer_t input_token and gss_const_OID token_oid, and writes the encapsulated result into a gss_buffer_t output_token. Returns OM_uint32 status codes GSS_S_COMPLETE or GSS_S_FAILURE.

security

protocol-element §5.1

The C binding gss_oid_equal() takes two gss_const_OID parameters and returns a C int: non-zero if both OIDs are non-null and equal, zero if they differ or either is GSS_C_NO_OID.

security

security-consideration §8

Encapsulation of data using GSS_Encapsulate_token does not provide any kind of integrity or confidentiality protection; the wrapper only identifies the mechanism via OID.

security

security-consideration §8

Implementations must treat input tokens as potentially untrustworthy when dereferencing memory objects to avoid security vulnerabilities. ASN.1 DER length fields are specifically called out as a common source of mistakes.

security

security-consideration §8

The security considerations of the base GSS-API specification (RFC 2743) and the base C bindings (RFC 2744) are inherited by this document.

security

wire-format §6

The encapsulated token format is an ASN.1 DER SEQUENCE: a 0x60 application tag byte, a DER-encoded length, a 0x06 OID tag byte, the DER-encoded OID length, the OID octets, then the raw token data. For example, 3-byte input 'foo' with OID 1.2.840.113554.1.2.2 produces the 16-byte sequence 60 0e 06 09 2a 86 48 86 f7 12 01 02 02 66 6f 6f.

security