order of preference likely reflects the capabilities and
engineering tradeoffs of a particular implementation.
However, the critical processing bottlenecks are frequently in the
receiver. The SPI Owner (receiver) may express its needs by
choosing a less preferable attribute.
The order may also be affected by operational policy and requested
services for an application. Such considerations are outside the
scope of this document.
The list may be divided into additional sections. These sections
will always follow the ESP-Attributes section, and are
indistinguishable from unrecognized attributes.
The authentication, compression, encryption and identification
mechanisms chosen, as well as the encapsulation modes (if any),
need not be the same in both directions.
5. Identification Exchange
Initiator Responder
========= =========
Identity_Request ->
make SPI
pick SPI attribute(s)
identify self
authenticate
make privacy key(s)
mask/encrypt message
<- Identity_Response
make SPI
pick SPI attribute(s)
identify self
authenticate
make privacy key(s)
mask/encrypt message
[make SPI session-keys in each direction]
The exchange of messages is ordered, although the formats and
meanings of the messages are identical in each direction. The
messages are easily distinguished by the parties themselves, by
examining the Message and Identification fields.
Implementation Notes:
The amount of time for the calculation may be dependent on the
value of particular bits in secret values used in generating the
shared-secret or identity verification. To prevent analysis of
these secret bits by recording the time for calculation, sending
of the Identity_Messages SHOULD be delayed until the time expected
for the longest calculation. This will be different for different
processor speeds, different algorithms, and different length
variables. Therefore, the method for estimating time is
implementation dependent.
Any authenticated and/or encrypted user datagrams received before
the completion of identity verification can be placed on a queue
pending completion of this step. If verification succeeds, the
queue is processed as though the datagrams had arrived subsequent
to the verification. If verification fails, the queue is
discarded.
5.0.1. Send Identity_Request
The Initiator chooses an appropriate Identification, the SPI and
SPILT, a set of Attributes for the SPI, calculates the Verification,
and masks the message using the Privacy-Method indicated by the
current Scheme-Choice.
The Initiator also starts a retransmission timer. If no valid
Identity_Response arrives within the time limit, its previous
Identity_Request is retransmitted for the remaining number of
Retransmissions.
When Retransmissions have been exceeded, if a Bad_Cookie message has
been received during the exchange, the Initiator SHOULD begin the
Photuris exchange again by sending a new Cookie_Request.
5.0.2. Receive Identity_Request
The Responder validates the pair of Cookies, the Padding, the
Identification, the Verification, and the Attribute-Choices.
- When an invalid/expired cookie is detected, a Bad_Cookie message
is sent.
- After unmasking, when invalid Padding is detected, the variable
length Attribute-Choices do not match the UDP Length, or an
attribute was not in the Offered-Attributes, the message is
silently discarded.
- When an invalid Identification is detected, or the message
verification fails, a Verification_Failure message is sent.
- Whenever such a problem is detected, the Security Association is
not established; the implementation SHOULD log the occurance, and
notify an operator as appropriate.
When the message is valid, the Responder sets its Exchange timer to
the Exchange LifeTime (if this has not already been done for a
previous exchange). When its parallel computation of the shared-
secret is complete, the Responder returns an Identity_Response.
The Responder keeps a copy of the incoming Identity_Request values,
and its Identity_Response. If a duplicate Identity_Request is
received, it merely resends its previous Identity_Response, and takes
no further action.
5.0.3. Send Identity_Response
The Responder chooses an appropriate Identification, the SPI and
SPILT, a set of Attributes for the SPI, calculates the Verification,
and masks the message using the Privacy-Method indicated by the
current Scheme-Choice.
The Responder calculates the SPI session-keys in both directions.
At this time, the Responder begins the authentication and/or
encryption of user datagrams.
5.0.4. Receive Identity_Response
The Initiator validates the pair of Cookies, the Padding, the
Identification, the Verification, and the Attribute-Choices.
- When an invalid/expired cookie is detected, the message is
silently discarded.
- After unmasking, when invalid Padding is detected, the variable
length Attribute-Choices do not match the UDP Length, or an
attribute was not in the Offered-Attributes, the message is
silently discarded.
- When an invalid Identification is detected, or the message
verification fails, a Verification_Failure message is sent.
- Whenever such a problem is detected, the Security Association is
not established; the implementation SHOULD log the occurance, and
notify an operator as appropriate.
- Once a valid message has been received, later Identity_Responses
with both matching cookies are also silently discarded, until a
new Cookie_Request is sent.
When the message is valid, the Initiator sets its Exchange timer to
the Exchange LifeTime (if this has not already been done for a
previous exchange).
The Initiator calculates the SPI session-keys in both directions.
At this time, the Initiator begins the authentication and/or
encryption of user datagrams.
5.1. Identity_Messages
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
~ Initiator-Cookie ~
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
~ Responder-Cookie ~
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Message | LifeTime |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Security-Parameters-Index |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
| Identity-Choice | |
+ + + + + + + + + + + + + + + + + +
| |
~ Identification ~
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
~ Verification ~
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Attribute-Choices ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
... Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Initiator-Cookie 16 bytes. Copied from the Value_Request.
Responder-Cookie 16 bytes. Copied from the Value_Request.
Message 4 (Request) or 7 (Response)
LifeTime 3 bytes. The number of seconds remaining before the
indicated SPI expires.
When the SPI is zero, this field MUST be filled with
a random non-zero value.
Security-Parameters-Index (SPI)
4 bytes. The SPI to be used for incoming
communications.
When zero, indicates that no SPI is created in this
direction.
Identity-Choice 2 or more bytes. An identity attribute is selected
from the list of Offered-Attributes sent by the
peer, and is used to calculate the Verification.
The field may be any integral number of bytes in
length, as indicated by its Length field. It does
not require any particular alignment. The 16-bit
alignment shown is for convenience in the
illustration.
Identification Variable Precision Integer, or alternative format
indicated by the Identity-Choice. See the "Basic
Attributes" for details.
The field may be any integral number of bytes in
length. It does not require any particular
alignment. The 32-bit alignment shown is for
convenience in the illustration.
Verification Variable Precision Integer, or alternative format
indicated by the Identity-Choice. The calculation
of the value is described in "Identity
Verification".
The field may be any integral number of bytes in
length. It does not require any particular
alignment. The 32-bit alignment shown is for
convenience in the illustration.
Attribute-Choices
0 or more bytes. When the SPI is non-zero, a list
of attributes selected from the list of Offered-
Attributes supported by the peer.
The contents and usage of this list are further
described in "Attribute Choices List". The end of
the list is indicated by the UDP Length after
removing the Padding (UDP Length - last Padding
value).
Padding 8 to 255 bytes. This field is filled up to at least
a 128 byte boundary, measured from the beginning of
the message. The number of pad bytes are chosen
randomly.
In addition, when a Privacy-Method indicated by the
current Scheme-Choice requires the plaintext to be a
multiple of some number of bytes (the block size of
a block cipher), this field is adjusted as necessary
to the size required by the algorithm.
Self-Describing-Padding begins with the value 1.
Each byte contains the index of that byte. Thus,
the final pad byte indicates the number of pad bytes
to remove. For example, when the unpadded message
length is 120 bytes, the padding values might be 1,
2, 3, 4, 5, 6, 7, and 8.
The portion of the message after the SPI field is masked using the
Privacy-Method indicated by the current Scheme-Choice.
The fields following the SPI are opaque. That is, the values are set
prior to masking (and optional encryption), and examined only after
unmasking (and optional decryption).
5.2. Attribute Choices List
This list specifies the attributes of the SPI. The attribute formats
are specified in the "Basic Attributes".
The list is composed of one or two sections: Authentication-
Attributes, and/or Encapsulation-Attributes.
When sending from the SPI User to the SPI Owner, the attributes are
processed in the order listed. For example,
"ESP-Attributes",
"Deflate" (Compression),
"XOR" (Encryption),
"DES-CBC" (Encryption),
"XOR" (Encryption),
"AH-Attributes",
"AH-Sequence",
"MD5-IPMAC" (Authentication),
would result in ESP with compression and triple encryption (inside),
and then AH authentication with sequence numbers (outside) of the ESP
payload.
The SPI Owner will naturally process the datagram in the reverse
order.
This ordering also affects the order of key generation. Both SPI
Owner and SPI User generate the keys in the order listed.
Implementation Notes:
When choices are made from the list of Offered-Attributes, it is
not required that any Security Association include every kind of
offered attribute in any single SPI, or that a separate SPI be
created for every offered attribute.
Some kinds of attributes may be included more than once in a
single SPI. The set of allowable combinations of attributes are
dependent on implementation and operational policy. Such
considerations are outside the scope of this document.
The list may be divided into additional sections. This can occur
only when both parties recognize the affected attributes.
The authentication, compression, encryption and identification
mechanisms chosen, as well as the encapsulation modes (if any),
need not be the same in both directions.
5.3. Shared-Secret
A shared-secret is used in a number of calculations. Regardless of
the internal representation of the shared-secret, when used in
calculations it is in the same form as the Value part of a Variable
Precision Integer:
- most significant byte first.
- bits used are right justified within byte boundaries.
- any unused bits are in the most significant byte.
- unused bits are zero filled.
The shared-secret does not include a Size field.
5.4. Identity Verification
These messages are authenticated using the Identity-Choice. The
Verification value is calculated prior to masking (and optional
encryption), and verified after unmasking (and optional decryption).
The Identity-Choice authentication function is supplied with two
input values:
- the sender (SPI Owner) verification-key,
- the data to be verified (as a concatenated sequence of bytes).
The resulting output value is stored in the Verification field.
The Identity-Choice verification data consists of the following
concatenated values:
+ the Initiator Cookie,
+ the Responder Cookie,
+ the Message, LifeTime and SPI fields,
+ the Identity-Choice and Identification,
+ the SPI User Identity Verification (response only),
+ the Attribute-Choices following the Verification field,
+ the Padding,
+ the SPI Owner TBV,
+ the SPI Owner Exchange-Value,
+ the SPI Owner Offered-Attributes,
+ the SPI User TBV,
+ the SPI User Exchange-Value,
+ the SPI User Offered-Attributes,
+ the Responder Offered-Schemes.
The TBV (Three Byte Value) consists of the Counter and Scheme-Choice
fields from the Value_Request, or the Reserved field from the
Value_Response, immediately preceding the associated Exchange-Value.
Note that the order of the Exchange-Value and Offered-Attributes
fields is different in each direction, and the Identification and SPI
fields are also likely to be different in each direction. Note also
that the SPI User Identity Verification (from the Identity_Request)
is present only in the Identity_Response.
If the verification fails, the users are notified, and a
Verification_Failure message is sent, without adding any SPI. On
success, normal operation begins with the authentication and/or
encryption of user datagrams.
Implementation Notes:
This is distinct from any authentication method specified for the
SPI.
The exact details of the Identification and verification-key
included in the Verification calculation are dependent on the
Identity-Choice, as described in the "Basic Attributes".
Each party may wish to keep their own trusted databases, such as
the Pretty Good Privacy (PGP) web of trust, and accept only those
identities found there. Failure to find the Identification in
either an internal or external database results in the same
Verification_Failure message as failure of the verification
computation.
The Exchange-Value data includes both the Size and Value fields.
The Offered-Attributes and Attribute-Choices data includes the
Attribute, Length and Value fields.
5.5. Privacy-Key Computation
Identification Exchange messages are masked using the Privacy-Method
indicated by the current Scheme-Choice. Masking begins with the next
field after the SPI, and continues to the end of the data indicated
by the UDP Length, including the Padding.
The Scheme-Choice specified Key-Generation-Function is used to create
a special privacy-key for each message. This function is calculated
over the following concatenated values:
+ the SPI Owner Exchange-Value,
+ the SPI User Exchange-Value,
+ the Initiator Cookie,
+ the Responder Cookie,
+ the Message, LifeTime and SPI (or Reserved) fields,
+ the computed shared-secret.
Since the order of the Exchange-Value fields is different in each
direction, and the Message, LifeTime and SPI fields are also
different in each direction, the resulting privacy-key will usually
be different in each direction.
When a larger number of keying-bits are needed than are available
from one iteration of the specified Key-Generation-Function, more
keying-bits are generated by duplicating the trailing shared-secret,
and recalculating the function. That is, the first iteration will
have one trailing copy of the shared-secret, the second iteration
will have two trailing copies of the shared-secret, and so forth.
Implementation Notes:
This is distinct from any encryption method specified for the SPI.
The length of the Padding, and other details, are dependent on the
Privacy-Method. See the "Basic Privacy-Method" list for details.
To avoid keeping the Exchange-Values in memory after the initial
verification, it is often possible to pre-compute the function
over the initial bytes of the concatenated data values for each
direction, and append the trailing copies of the shared-secret.
The Exchange-Value data includes both the Size and Value fields.
5.6. Session-Key Computation
Each SPI has one or more session-keys. These keys are generated
based on the attributes of the SPI. See the "Basic Attributes" for
details.
The Scheme-Choice specified Key-Generation-Function is used to create
the SPI session-key for that particular attribute. This function is
calculated over the following concatenated values:
+ the Initiator Cookie,
+ the Responder Cookie,
+ the SPI Owner generation-key,
+ the SPI User generation-key,
+ the message Verification field,
+ the computed shared-secret.
Since the order of the generation-keys is different in each
direction, and the Verification field is also likely to be different
in each direction, the resulting session-key will usually be
different in each direction.
When a larger number of keying-bits are needed than are available
from one iteration of the specified Key-Generation-Function, more
keying-bits are generated by duplicating the trailing shared-secret,
and recalculating the function. That is, the first iteration will
have one trailing copy of the shared-secret, the second iteration
will have two trailing copies of the shared-secret, and so forth.
Implementation Notes:
This is distinct from any privacy-key generated for the Photuris
exchange. Different initialization data is used, and iterations
are maintained separately.
The exact details of the Verification field and generation-keys
that are included in the session-key calculation are dependent on
the Identity-Choices, as described in the "Basic Attributes".
To avoid keeping the generation-keys in memory after the initial
verification, it is often possible to pre-compute the function
over the initial bytes of the concatenated data values for each
direction, and append the trailing copies of the shared-secret.
When both authentication and encryption attributes are used for
the same SPI, there may be multiple session-keys associated with
the same SPI. These session-keys are generated in the order of
the Attribute-Choices list.
6. SPI Messages
SPI User SPI Owner
======== =========
SPI_Needed ->
list SPI attribute(s)
make validity key
authenticate
make privacy key(s)
mask/encrypt message
<- SPI_Update
make SPI
pick SPI attribute(s)
make SPI session-key(s)
make validity key
authenticate
make privacy key(s)
mask/encrypt message
The exchange of messages is not related to the Initiator and
Responder. Instead, either party may send one of these messages at
any time. The messages are easily distinguished by the parties.
6.0.1. Send SPI_Needed
At any time after completion of the Identification Exchange, either
party can send SPI_Needed. This message is sent when a prospective
SPI User needs particular attributes for a datagram (such as
confidentiality), and no current SPI has those attributes.
The prospective SPI User selects from the intersection of attributes
that both parties have previously offered, calculates the
Verification, and masks the message using the Privacy-Method
indicated by the current Scheme-Choice.
6.0.2. Receive SPI_Needed
The potential SPI Owner validates the pair of Cookies, the Padding,
the Verification, and the Attributes-Needed.
- When an invalid/expired cookie is detected, a Bad_Cookie message
is sent.
- When too many SPI values are already in use for this particular
peer, or some other resource limit is reached, a Resource_Limit
message is sent.
- After unmasking, when invalid Padding is detected, the variable
length Attributes-Needed do not match the UDP Length, or an
attribute was not in the Offered-Attributes, the message is
silently discarded.
- When the message verification fails, a Verification_Failure
message is sent.
- Whenever such a problem is detected, the SPI is not established;
the implementation SHOULD log the occurance, and notify an
operator as appropriate.
When the message is valid, the party SHOULD send SPI_Update with the
necessary attributes.
If an existing SPI has those attributes, that SPI is returned in the
SPI_Update with the remaining SPILT.
6.0.3. Send SPI_Update
At any time after completion of the Identification Exchange, either
party can send SPI_Update. This message has effect in only one
direction, from the SPI Owner to the SPI User.
The SPI Owner chooses the SPI and SPILT, a set of Attributes for the
SPI, calculates the Verification, and masks the message using the
Privacy-Method indicated by the current Scheme-Choice.
6.0.4. Receive SPI_Update
The prospective SPI User validates the pair of Cookies, the Padding,
the Verification, and the Attributes-Needed.
- When an invalid/expired cookie is detected, a Bad_Cookie message
is sent.
- After unmasking, when invalid Padding is detected, the variable
length Attribute-Choices do not match the UDP Length, an attribute
was not in the Offered-Attributes, or the message modifies an
existing SPI, the message is silently discarded.
- When the message verification fails, a Verification_Failure
message is sent.
- Whenever such a problem is detected, the SPI is not established;
the implementation SHOULD log the occurance, and notify an
operator as appropriate.
When the message is valid, further actions are dependent on the value
of the LifeTime field, as described later.
6.0.5. Automated SPI_Updates
Each SPI requires replacement under several circumstances:
- the volume of data processed (inhibiting probability
cryptanalysis),
- exhaustion of available anti-replay Sequence Numbers,
- and expiration of the LifeTime.
In general, a determination is made upon receipt of a datagram. If
the transform specific processing finds that refreshment is needed,
an automated SPI_Update is triggered.
In addition, automated SPI_Updates allow rapid SPI refreshment for
high bandwidth applications in a high delay environment. The update
messages flow in the opposite direction from the primary traffic,
conserving bandwidth and avoiding service interruption.
When creating each SPI, the implementation MAY optionally set an
Update TimeOut (UTO); by default, to half the value of the LifeTime
(SPILT/2). This time is highly dynamic, and adjustable to provide an
automated SPI_Update long before transform specific processing. If
no new Photuris exchange occurs within the time limit, and the
current exchange state has not expired, an automated SPI_Update is
sent.
6.1. SPI_Needed
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
~ Initiator-Cookie ~
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
~ Responder-Cookie ~
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Message | Reserved-LT |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Reserved-SPI |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
| |
~ Verification ~
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Attributes-Needed ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
... Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Initiator-Cookie 16 bytes. Copied from the Value_Request.
Responder-Cookie 16 bytes. Copied from the Value_Request.
Message 8
Reserved-LT 3 bytes. For future use; MUST be filled with a
random non-zero value when transmitted, and MUST be
ignored when received.
Reserved-SPI 4 bytes. For future use; MUST be set to zero when
transmitted, and MUST be ignored when received.
Verification Variable Precision Integer, or other format
indicated by the current Scheme-Choice. The
calculation of the value is described in "Validity
Verification".
The field may be any integral number of bytes in
length. It does not require any particular
alignment. The 32-bit alignment shown is for
convenience in the illustration.
Attributes-Needed
4 or more bytes. A list of two or more attributes,
selected from the list of Offered-Attributes
supported by the peer.
The contents and usage of this list are as
previously described in "Attribute Choices List".
The end of the list is indicated by the UDP Length
after removing the Padding (UDP Length - last
Padding value).
Padding 8 or more bytes. The message is padded in the same
fashion specified for Identification Exchange
messages.
The portion of the message after the SPI field is masked using the
Privacy-Method indicated by the current Scheme-Choice.
The fields following the SPI are opaque. That is, the values are set
prior to masking (and optional encryption), and examined only after
unmasking (and optional decryption).
6.2. SPI_Update
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
~ Initiator-Cookie ~
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
~ Responder-Cookie ~
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Message | LifeTime |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Security-Parameters-Index |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
| |
~ Verification ~
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Attribute-Choices ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
... Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Initiator-Cookie 16 bytes. Copied from the Value_Request.
Responder-Cookie 16 bytes. Copied from the Value_Request.
Message 9
LifeTime 3 bytes. The number of seconds remaining before the
indicated SPI expires. The value zero indicates
deletion of the indicated SPI.
Security-Parameters-Index (SPI)
4 bytes. The SPI to be used for incoming
communications.
This may be a new SPI value (for creation), or an
existing SPI value (for deletion). The value zero
indicates special processing.
Verification Variable Precision Integer, or other format
indicated by the current Scheme-Choice. The
calculation of the value is described in "Validity
Verification".
The field may be any integral number of bytes in
length. It does not require any particular
alignment. The 32-bit alignment shown is for
convenience in the illustration.
Attribute-Choices
0 or more bytes. When the SPI and SPILT are non-
zero, a list of attributes selected from the list of
Offered-Attributes supported by the peer.
The contents and usage of this list are as
previously described in "Attribute Choices List".
The end of the list is indicated by the UDP Length
after removing the Padding (UDP Length - last
Padding value).
Padding 8 or more bytes. The message is padded in the same
fashion specified for Identification Exchange
messages.
The portion of the message after the SPI field is masked using the
Privacy-Method indicated by the current Scheme-Choice.
The fields following the SPI are opaque. That is, the values are set
prior to masking (and optional encryption), and examined only after
unmasking (and optional decryption).
6.2.1. Creation
When the LifeTime is non-zero, and the SPI is also non-zero, the
SPI_Update can be used to create a new SPI. When the SPI is zero,
the SPI_Update is silently discarded.
The new session-keys are calculated in the same fashion as the
Identity_Messages. Since the SPI value is always different than any
previous SPI during the Exchange LifeTime of the shared-secret, the
resulting session-keys will necessarily be different from all others
used in the same direction.
No retransmission timer is necessary. Success is indicated by the
peer use of the new SPI.
Should all creation attempts fail, eventually the peer will find that
all existing SPIs have expired, and will begin the Photuris exchange
again by sending a new Cookie_Request. When appropriate, this
Cookie_Request MAY include a Responder-Cookie to retain previous
party pairings.
6.2.2. Deletion
When the LifeTime is zero, the SPI_Update can be used to delete a
single existing SPI. When the SPI is also zero, the SPI_Update will
delete all existing SPIs related to this Security Association, and
mark the Photuris exchange state as expired. This is especially
useful when the application that needed them terminates.
No retransmission timer is necessary. This message is advisory, to
reduce the number of ICMP Security Failures messages.
Should any deletion attempts fail, the peer will learn that the
deleted SPIs are invalid through the normal ICMP Security Failures
messages, and will initiate a Photuris exchange by sending a new
Cookie_Request.
6.2.3. Modification
The SPI_Update cannot be used to modify existing SPIs, such as
lengthen an existing SPI LifeTime, resurrect an expired SPI, or
add/remove an Attribute-Choice.
On receipt, such an otherwise valid message is silently discarded.
6.3. Validity Verification
These messages are authenticated using the Validity-Method indicated
by the current Scheme-Choice. The Verification value is calculated
prior to masking (and optional encryption), and verified after
unmasking (and optional decryption).
The Validity-Method authentication function is supplied with two
input values:
- the sender (SPI Owner) verification-key,
- the data to be verified (as a concatenated sequence of bytes).
The resulting output value is stored in the Verification field.
The Validity-Method verification data consists of the following
concatenated values:
+ the Initiator Cookie,
+ the Responder Cookie,
+ the Message, LifeTime and SPI (or Reserved) fields,
+ the SPI Owner Identity Verification,
+ the SPI User Identity Verification,
+ the Attribute-Choices following the Verification field,
+ the Padding.
Note that the order of the Identity Verification fields (from the
Identity_Messages) is different in each direction, and the Message,
LifeTime and SPI fields are also likely to be different in each
direction.
If the verification fails, the users are notified, and a
Verification_Failure message is sent, without adding or deleting any
SPIs. On success, normal operation begins with the authentication
and/or encryption of user datagrams.
Implementation Notes:
This is distinct from any authentication method specified for the
SPI.
The Identity Verification data includes both the Size and Value
fields. The Attribute-Choices data includes the Attribute, Length
and Value fields.
7. Error Messages
These messages are issued in response to Photuris state loss or other
problems. A message has effect in only one direction. No
retransmission timer is necessary.
These messages are not masked.
The receiver checks the Cookies for validity. Special care MUST be
taken that the Cookie pair in the Error Message actually match a pair
currently in use, and that the protocol is currently in a state where
such an Error Message might be expected. Otherwise, these messages
could provide an opportunity for a denial of service attack. Invalid
messages are silently discarded.
7.1. Bad_Cookie
For the format of the 33 byte message, see "Header Format". There
are no additional fields.
Initiator-Cookie 16 bytes. Copied from the offending message.
Responder-Cookie 16 bytes. Copied from the offending message.
Message 10
This error message is sent when a Value_Request, Identity_Request,
SPI_Needed, or SPI_Update is received, and the receiver specific
Cookie is invalid or the associated exchange state has expired.
During the Photuris exchange, when this error message is received, it
has no immediate effect on the operation of the protocol phases.
Later, when Retransmissions have been exceeded, and this error
message has been received, the Initiator SHOULD begin the Photuris
exchange again by sending a new Cookie_Request with the Responder-
Cookie and Counter updated appropriately.
When this error message is received in response to SPI_Needed, the
exchange state SHOULD NOT be marked as expired, but the party SHOULD
initiate a Photuris exchange by sending a new Cookie_Request.
When this error message is received in response to SPI_Update, the
exchange state SHOULD NOT be marked as expired, and no further action
is taken. A new exchange will be initiated later when needed by the
peer to send authenticated and/or encrypted data.
Existing SPIs are not deleted. They expire normally, and are purged
sometime later.
7.2. Resource_Limit
For the format of the 34 byte message, see "Cookie_Request". There
are no additional fields.
Initiator-Cookie 16 bytes. Copied from the offending message.
Responder-Cookie 16 bytes. Copied from the offending message.
Special processing is applied to a Cookie_Request.
When the offending message Responder-Cookie and
Counter were both zero, and an existing exchange has
not yet been purged, this field is replaced with the
Responder-Cookie from the existing exchange.
Message 11
Counter 1 byte. Copied from the offending message.
When zero, the Responder-Cookie indicates the
Initiator of a previous exchange, or no previous
exchange is specified.
When non-zero, the Responder-Cookie indicates the
Responder to a previous exchange. This value is set
to the Counter from the corresponding
Cookie_Response.
This error message is sent when a Cookie_Request, Value_Request or
SPI_Needed is received, and too many SPI values are already in use
for that peer, or some other Photuris resource is unavailable.
During the Photuris exchange, when this error message is received in
response to a Cookie_Request or Value_Request, the implementation
SHOULD double the retransmission timeout (as usual) for sending
another Cookie_Request or Value_Request. Otherwise, it has no
immediate effect on the operation of the protocol phases. Later,
when Retransmissions have been exceeded, and this error message has
been received, the Initiator SHOULD begin the Photuris exchange again
by sending a new Cookie_Request with the Responder-Cookie and Counter
updated appropriately.
When this error message is received in response to SPI_Needed, the
implementation SHOULD NOT send another SPI_Needed until one of the
existing SPIs associated with this exchange is deleted or has
expired.
7.3. Verification_Failure
For the format of the 33 byte message, see "Header Format". There
are no additional fields.
Initiator-Cookie 16 bytes. Copied from the offending message.
Responder-Cookie 16 bytes. Copied from the offending message.
Message 12
This error message is sent when an Identity_Message, SPI_Needed or
SPI_Update is received, and verification fails.
When this error message is received, the implementation SHOULD log
the occurance, and notify an operator as appropriate. However,
receipt has no effect on the operation of the protocol.
7.4. Message_Reject
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
~ Initiator-Cookie ~
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
~ Responder-Cookie ~
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Message | Bad-Message | Offset |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Initiator-Cookie 16 bytes. Copied from the offending message.
Responder-Cookie 16 bytes. Copied from the offending message.
Message 13
Bad-Message 1 byte. Indicates the Message number of the
offending message.
Offset 2 bytes. The number of bytes from the beginning of
the offending message where the unrecognized field
starts. The minimum value is 32.
This error message is sent when an optional Message type is received
that is not supported, or an optional format of a supported Message
is not recognized.
When this error message is received, the implementation SHOULD log
the occurance, and notify an operator as appropriate. However,
receipt has no effect on the operation of the protocol.
8. Public Value Exchanges
Photuris is based in principle on public-key cryptography,
specifically Diffie-Hellman key exchange. Exchange of public D-H
Exchange-Values based on private-secret values results in a mutual
shared-secret between the parties. This shared-secret can be used on
its own, or to generate a series of session-keys for authentication
and encryption of subsequent traffic.
This document assumes familiarity with the Diffie-Hellman public-key
algorithm. A good description can be found in [Schneier95].
8.1. Modular Exponentiation Groups
The original Diffie-Hellman technique [DH76] specified modular
exponentiation. A public-value is generated using a generator (g),
raised to a private-secret exponent (x), modulo a prime (p):
(g**x) mod p.
When these public-values are exchanged between parties, the parties
can calculate a shared-secret value between themselves:
(g**xy) mod p.
The generator (g) and modulus (p) are established by the Scheme-
Choice (see the "Basic Exchange-Schemes" for details). They are
offered in the Cookie_Response, and one pair is chosen in the
Value_Request.
The private exponents (x) and (y) are kept secret by the parties.
Only the public-value result of the modular exponentiation with (x)
or (y) is sent as the Initiator and Responder Exchange-Value.
These public-values are represented in single Variable Precision
Integers. The Size of these Exchange-Values will match the Size of
the modulus (p).
8.2. Moduli Selection
Each implementation proposes one or more moduli in its Offered-
Schemes. Every implementation MUST support up to 1024-bit moduli.
For any particular Photuris node, these moduli need not change for
significant periods of time; likely days or weeks. A background
process can periodically generate new moduli.
For 512-bit moduli, current estimates would provide 64
(pessimistic) bit-equivalents of cryptographic strength.
For 1024-bit moduli, current estimates would range from 80
(pessimistic) through 98 (optimistic) bit-equivalents of
cryptographic strength.
These estimates are used when choosing moduli that are appropriate
for the desired Security Parameter attributes.
8.2.1. Bootstrap Moduli
Each implementation is likely to use a fixed modulus during its
bootstrap, until it can generate another modulus in the background.
As the bootstrap modulus will be widely distributed, and reused
whenever the machine reinitializes, it SHOULD be a "safe" prime (p =
2q+1) to provide the greatest long-term protection.
Implementors are encouraged to generate their own bootstrap moduli,
and to change bootstrap moduli in successive implementation releases.
8.2.2. Learning Moduli
As Photuris exchanges are initiated, new moduli will be learned from
the Responder Offered-Schemes. The Initiator MAY cache these moduli
for its own use.
Before offering any learned modulus, the implementation MUST perform
at least one iteration of probable primality verification. In this
fashion, many processors will perform verification in parallel as
moduli are passed around.
When primality verification failures are found, the failed moduli
SHOULD be retained for some (implementation dependent) period of
time, to avoid re-learning and re-testing after subsequent exchanges.
8.3. Generator Selection
The generator (g) should be chosen such that the private-secret
exponents will generate all possible public-values, evenly
distributed throughout the range of the modulus (p), without cycling
through a smaller subset. Such a generator is called a "primitive
root" (which is trivial to find when p is "safe").
Only one generator (2) is required to be supported.
Implementation Notes:
One useful technique is to select the generator, and then limit
the modulus selection sieve to primes with that generator:
2 when p (mod 24) = 11.
3 when p (mod 12) = 5.
5 when p (mod 10) = 3 or 7.
The required generator (2) improves efficiency in multiplication
performance. It is usable even when it is not a primitive root,
as it still covers half of the space of possible residues.
8.4. Exponent Selection
Each implementation generates a separate random private-secret
exponent for each different modulus. Then, a D-H Exchange-Value is
calculated for the given modulus, generator, and exponent.
This specification recommends that the exponent length be at least
twice the desired cryptographic strength of the longest session-key
needed by the strongest offered-attribute.
Based on the estimates in "Moduli Selection" (above):
For 512-bit moduli, exponent lengths of 128 bits (or more) are
recommended.
For 1024-bit moduli, exponent lengths of 160 to 256 bits (or more)
are recommended.
Although the same exponent and Exchange-Value may be used with
several parties whenever the same modulus and generator are used, the
exponent SHOULD be changed at random intervals. A background process
can periodically destroy the old values, generate a new random
private-secret exponent, and recalculate the Exchange-Value.
Implementation Notes:
The size of the exponent is entirely implementation dependent, is
unknown to the other party, and can be easily changed.
Since these operations involve several time-consuming modular
exponentiations, moving them to the "background" substantially
improves the apparent execution speed of the Photuris protocol.
It also reduces CPU loading sufficiently to allow a single
public/private key-pair to be used in several closely spaced
Photuris executions, when creating Security Associations with
several different nodes over a short period of time.
Other pre-computation suggestions are described in [BGMW93, LL94,
Rooij94].
8.5. Defective Exchange Values
Some exponents do not qualify as secret. The exponent 0 will
generate the Exchange-Value 1, and the exponent 1 will generate the
Exchange-Value g. Small exponents will be easily visible and SHOULD
be avoided where:
g**x < p.
Depending on the structure of the moduli, certain exponents can be
used for sub-group confinement attacks. For "safe" primes (p =
2q+1), these exponents are p-1 and (p-1)/2, which will generate the
Exchange-Values 1 and p-1 respectively.
When an implementation chooses a random exponent, the resulting
Exchange-Value is examined. If the Exchange-Value is represented in
less than half the number of significant bits in the modulus, then a
new random exponent MUST be chosen.
For 512-bit moduli, Exchange-Values of 2**256 or greater are
required.
For 1024-bit moduli, Exchange-Values of 2**512 or greater are
required.
In addition, if the resulting Exchange-Value is p-1, then a new
random exponent MUST be chosen.
Upon receipt of an Exchange-Value that fails to meet the
requirements, the Value Exchange message is silently discarded.
Implementation Notes:
Avoidance of small exponents can be assured by setting at least
one bit in the most significant half of the exponent.
9. Basic Exchange-Schemes
Initial values are assigned as follows:
(0) Reserved.
(1) Reserved.
(2) Implementation Required. Any modulus (p) with a recommended
generator (g) of 2. When the Exchange-Scheme Size is non-zero,
the modulus is contained in the Exchange-Scheme Value field in
the list of Offered-Schemes.
An Exchange-Scheme Size of zero is invalid.
Key-Generation-Function "MD5 Hash"
Privacy-Method "Simple Masking"
Validity-Method "MD5-IPMAC Check"
This combination of features requires a modulus with at least
64-bits of cryptographic strength.
(3) Exchange-Schemes 3 to 255 are intended for future well-known
published schemes.
(256) Exchange-Schemes 256 to 32767 are intended for vendor-specific
unpublished schemes. Implementors wishing a number MUST
request the number from the authors.
(32768)
Exchange-Schemes 32768 to 65535 are available for cooperating
parties to indicate private schemes, regardless of vendor
implementation. These numbers are not reserved, and are
subject to duplication. Other criteria, such as the IP Source
and Destination of the Cookie_Request, are used to
differentiate the particular Exchange-Schemes available.
10. Basic Key-Generation-Function
10.1. MD5 Hash
MD5 [RFC-1321] is used as a pseudo-random-function for generating the
key(s). The key(s) begin with the most significant bits of the hash.
MD5 is iterated as needed to generate the requisite length of key
material.
When an individual key does not use all 128-bits of the last hash,
any remaining unused (least significant) bits of the last hash are
discarded. When combined with other uses of key generation for the
same purpose, the next key will begin with a new hash iteration.
11. Basic Privacy-Method
11.1. Simple Masking
As described in "Privacy-Key Computation", sufficient privacy-key
material is generated to match the message length, beginning with the
next field after the SPI, and including the Padding. The message is
masked by XOR with the privacy-key.
12. Basic Validity-Method
12.1. MD5-IPMAC Check
As described in "Validity Verification", the Verification field value
is the MD5 [RFC-1321] hash over the concatenation of
MD5( key, keyfill, data, datafill, key, md5fill )
where the key is the computed verification-key.
The keyfill and datafill use the same pad-with-length technique
defined for md5fill. This padding and length is implicit, and does
not appear in the datagram.
The resulting Verification field is a 128-bit Variable Precision
Integer (18 bytes including Size). When used in calculations, the
Verification data includes both the Size and Value fields.
13. Basic Attributes
Implementors wishing a number MUST request the number from the
authors. Initial values are assigned as follows:
Use Type
- 0* padding
- 1* AH-Attributes
- 2+ ESP-Attributes
AEI 5* MD5-IPMAC
AEIX 255+ Organizational
A AH Attribute-Choice
E ESP Attribute-Choice
I Identity-Choice
X dependent on list location
+ feature must be recognized even when not supported
* feature must be supported (mandatory)
Other attributes are specified in companion documents.
13.1. Padding
+-+-+-+-+-+-+-+-+
| Attribute |
+-+-+-+-+-+-+-+-+
Attribute 0
Each attribute may have value fields that are multiple bytes. To
facilitate processing efficiency, these fields are aligned on
integral modulo 8 byte (64-bit) boundaries.
Padding is accomplished by insertion of 1 to 7 Attribute 0 padding
bytes before the attribute that needs alignment.
No padding is used after the final attribute in a list.
13.2. AH-Attributes
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Attribute | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Attribute 1
Length 0
When a list of Attributes is specified, this Attribute begins the
section of the list which applies to the Authentication Header (AH).