Skip to content

Commit 580a19b

Browse files
committed
Reorganize to avoid normative references in appendices
1 parent c343353 commit 580a19b

1 file changed

Lines changed: 69 additions & 67 deletions

File tree

draft-denis-ipcrypt.md

Lines changed: 69 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ informative:
117117

118118
--- abstract
119119

120-
This document specifies methods for encrypting and obfuscating IP addresses for privacy-preserving storage, logging, and analytics. These encrypted addresses enable data analysis and correlation while protecting user privacy, addressing concerns raised in {{!RFC6973}} and {{!RFC7258}} regarding pervasive monitoring. The methods apply uniformly to both IPv4 and IPv6 addresses by converting them into a 16-byte representation.
120+
This document specifies methods for encrypting and obfuscating IP addresses for privacy-preserving storage, logging, and analytics. These encrypted addresses enable data analysis while protecting user privacy, addressing concerns raised in {{!RFC6973}} and {{!RFC7258}} regarding pervasive monitoring. The methods apply uniformly to both IPv4 and IPv6 addresses.
121121

122-
Three concrete instantiations are defined: `ipcrypt-deterministic` provides reversible deterministic encryption with format preservation, always producing the same output for a given input; `ipcrypt-nd` and `ipcrypt-ndx` provide non-deterministic encryption that produces different outputs for the same input by incorporating randomness. All methods are reversible with the encryption key. Non-deterministic modes produce larger outputs to prevent correlation of identical inputs while maintaining full reversibility.
122+
Three concrete instantiations are defined: `ipcrypt-deterministic` provides deterministic, format-preserving encryption, while `ipcrypt-nd` and `ipcrypt-ndx` introduce randomness to prevent correlation. All methods are reversible with the encryption key.
123123

124124
--- middle
125125

@@ -159,7 +159,7 @@ These specialized encryption methods unlock several critical use cases:
159159

160160
- **Seamless Third-Party Integration:** Encrypted IPs can act as privacy-preserving identifiers when interacting with untrusted services, cloud providers, or external platforms.
161161

162-
For implementation guidelines and practical examples, see {{pseudocode-and-examples}}.
162+
For implementation guidelines and practical examples, see {{implementation-details}}.
163163

164164
## Relationship to IETF Work
165165

@@ -246,7 +246,7 @@ Implementers MUST choose a cipher that meets the required security properties an
246246

247247
Deterministic encryption applies a 128-bit block cipher directly to the 16-byte representation of an IP address. All instantiations documented in this specification (`ipcrypt-deterministic`, `ipcrypt-nd`, and `ipcrypt-ndx`) are invertible - encrypted IP addresses can be decrypted back to their original values using the same key. For non-deterministic modes, the tweak must be preserved along with the ciphertext to enable decryption.
248248

249-
For implementation details, see {{pseudocode-and-examples}}.
249+
For implementation details, see {{implementation-details}}.
250250

251251
## ipcrypt-deterministic
252252

@@ -291,7 +291,7 @@ To ensure IPv4 format preservation, implementers MUST consider using cycle-walki
291291

292292
# Non-Deterministic Encryption {#non-deterministic-encryption}
293293

294-
Non-deterministic encryption leverages a tweakable block cipher together with a random tweak. For implementation details, see {{pseudocode-and-examples}}.
294+
Non-deterministic encryption leverages a tweakable block cipher together with a random tweak. For implementation details, see {{implementation-details}}.
295295

296296
## Encryption Process
297297

@@ -356,6 +356,16 @@ As with `ipcrypt-nd`, an `(input, tweak)` collision reveals repetition without c
356356
- **`ipcrypt-nd` (KIASU-BC):** Produces a 24-byte output using an 8-byte tweak; `(input, tweak)` collisions reveal repeated inputs (with the same tweak) but not their values. Expected collision after approximately 4 billion operations per key.
357357
- **`ipcrypt-ndx` (AES-XTS):** Produces a 32-byte output using a 16-byte tweak; supports higher secure operation counts per key. Expected collision after approximately 18 quintillion operations per key.
358358

359+
## Alternatives to Random Tweaks {#alternatives-to-random-tweaks}
360+
361+
While this specification recommends the use of uniformly random tweaks for non-deterministic encryption, implementers may consider alternative approaches:
362+
363+
- **Monotonic Counter:** A counter could be used as a tweak, but this is difficult to maintain in distributed systems. If the counter is not encrypted and the tweakable block cipher is not secure against related-tweak attacks, this could enable correlation attacks.
364+
365+
- **UUIDs:** UUIDs (such as UUIDv6 or UUIDv7) could be used as tweaks; however, these would reveal the original timestamp of the logged IP addresses, which may not be desirable from a privacy perspective.
366+
367+
Although the birthday bound is a concern with random tweaks, the use of random tweaks remains the recommended and most practical approach, offering the best tradeoffs for most real-world use cases.
368+
359369
# Security Considerations
360370

361371
The ipcrypt constructions focus solely on confidentiality and do not provide integrity. This means that IP addresses in an ordered sequence can be partially removed, duplicated, reordered, or blindly altered by an active adversary. Applications that require sequences of encrypted IP addresses that cannot be modified must apply an authentication scheme over the entire sequence, such as an HMAC construction, a keyed hash function, or a public key signature. This is outside the scope of this specification, but implementers should be aware that additional authentication mechanisms are required if protection against active adversaries is needed.
@@ -392,42 +402,15 @@ This specification focuses on the cryptographic transformations and does not man
392402

393403
For high-volume deployments processing billions of IP addresses, regular key rotation (e.g., monthly or quarterly) is RECOMMENDED to stay well within the security bounds discussed in this document.
394404

395-
# Implementation Status
405+
# Implementation Details {#implementation-details}
396406

397-
*This section is to be removed before publishing as an RFC.*
407+
This section provides detailed pseudocode and implementation guidance for the key operations described in this document.
398408

399-
This section records the status of known implementations of the protocol defined by this specification at the time of posting of this Internet-Draft, and is based on a proposal described in {{!RFC7942}}. The description of implementations in this section is intended to assist the Independent Submissions Editor in judging whether the specification is suitable for publication.
409+
## Visual Diagrams {#diagrams}
400410

401-
Please note that the listing of any individual implementation here does not imply endorsement. Furthermore, no effort has been spent to verify the information presented here that was supplied by contributors. This is not intended as, and must not be construed to be, a catalog of available implementations or their features.
411+
The following diagrams illustrate the key processes described in this specification.
402412

403-
Multiple interoperable implementations of the schemes described in this document have been developed:
404-
405-
- C implementation
406-
- D implementation
407-
- Go implementation
408-
- Java implementation (maven package)
409-
- JavaScript/TypeScript implementation (npm package)
410-
- PHP implementation (Composer package)
411-
- Python reference implementation
412-
- Rust implementation (cargo package)
413-
- Zig implementation
414-
- Dart implementation (pub.dev package)
415-
416-
A comprehensive list of implementations and their test results can be found at: https://ipcrypt-std.github.io/implementations/
417-
418-
All implementations pass the common test vectors specified in this document, demonstrating interoperability across programming languages.
419-
420-
# IANA Considerations
421-
422-
This document does not require any IANA actions.
423-
424-
--- back
425-
426-
# Diagrams {#diagrams}
427-
428-
This appendix provides visual representations of the key operations described in this document. For implementation details, see {{pseudocode-and-examples}}.
429-
430-
## IPv4 Address Conversion Diagram {#ipv4-address-conversion-diagram}
413+
### IPv4 Address Conversion Diagram {#ipv4-address-conversion-diagram}
431414

432415
~~~
433416
IPv4: 192.0.2.1
@@ -440,7 +423,7 @@ This appendix provides visual representations of the key operations described in
440423
[00 00 00 00 00 00 00 00 00 00 | FF FF | C0 00 02 01]
441424
~~~
442425

443-
## Deterministic Encryption Flow
426+
### Deterministic Encryption Flow
444427

445428
~~~
446429
IP Address
@@ -461,7 +444,7 @@ This appendix provides visual representations of the key operations described in
461444
Encrypted IP Address
462445
~~~
463446

464-
## Non‑Deterministic Encryption Flow (ipcrypt-nd)
447+
### Non‑Deterministic Encryption Flow (ipcrypt-nd)
465448

466449
~~~
467450
IP Address
@@ -485,7 +468,7 @@ This appendix provides visual representations of the key operations described in
485468
24-Byte Output (ipcrypt-nd)
486469
~~~
487470

488-
## Non‑Deterministic Encryption Flow (ipcrypt-ndx)
471+
### Non‑Deterministic Encryption Flow (ipcrypt-ndx)
489472

490473
~~~
491474
IP Address
@@ -509,10 +492,6 @@ This appendix provides visual representations of the key operations described in
509492
32-Byte Output (ipcrypt-ndx)
510493
~~~
511494

512-
# Pseudocode and Examples {#pseudocode-and-examples}
513-
514-
This appendix provides detailed pseudocode for key operations described in this document. For a visual representation of these operations, see {{diagrams}}.
515-
516495
## IPv4 Address Conversion
517496

518497
For a diagram of this conversion process, see {{ipv4-address-conversion-diagram}}.
@@ -680,15 +659,15 @@ function ipcrypt_ndx_decrypt(ciphertext, key):
680659
return ip_address
681660
~~~
682661

683-
# Implementing KIASU-BC {#implementing-kiasu-bc}
662+
## KIASU-BC Implementation Guide {#implementing-kiasu-bc}
684663

685-
This appendix provides a detailed guide for implementing the KIASU-BC tweakable block cipher. KIASU-BC is based on AES-128 with modifications to incorporate a tweak.
664+
This section provides a detailed guide for implementing the KIASU-BC tweakable block cipher used in `ipcrypt-nd`. KIASU-BC is based on AES-128 with modifications to incorporate a tweak.
686665

687-
## Overview
666+
### Overview
688667

689668
KIASU-BC extends AES-128 by incorporating an 8-byte tweak into each round. The tweak is padded to 16 bytes and XORed with the round key at each round of the cipher. This construction is used in the `ipcrypt-nd` instantiation.
690669

691-
## Tweak Padding
670+
### Tweak Padding
692671

693672
The 8-byte tweak is padded to 16 bytes using the following method:
694673

@@ -703,7 +682,7 @@ Example:
703682
16-byte padded: [T0 T1 00 00 T2 T3 00 00 T4 T5 00 00 T6 T7 00 00]
704683
~~~
705684

706-
## Round Structure
685+
### Round Structure
707686

708687
Each round of KIASU-BC consists of the following standard AES operations:
709688

@@ -714,15 +693,15 @@ Each round of KIASU-BC consists of the following standard AES operations:
714693

715694
For details about these operations, see {{FIPS-197}}.
716695

717-
## Key Schedule
696+
### Key Schedule
718697

719698
The key schedule follows the standard AES-128 key expansion:
720699

721700
1. The initial key is expanded into 11 round keys
722701
2. Each round key is XORed with the padded tweak before use
723702
3. The first round key is used in the initial AddRoundKey operation
724703

725-
## Implementation Steps
704+
### Implementation Steps
726705

727706
1. **Key Expansion:**
728707
- Expand the 16-byte key into 11 round keys using the standard AES key schedule
@@ -744,7 +723,7 @@ The key schedule follows the standard AES-128 key expansion:
744723
- ShiftRows
745724
- AddRoundKey (with tweaked round key)
746725

747-
## Example Implementation
726+
### Example Implementation
748727

749728
The following pseudocode illustrates the core operations of KIASU-BC:
750729

@@ -785,15 +764,44 @@ function kiasu_bc_encrypt(key, tweak, plaintext):
785764
return state
786765
~~~
787766

788-
# Test Vectors {#test-vectors}
789-
790-
This appendix provides test vectors for all three variants of ipcrypt. Each test vector includes the key, input IP address, and encrypted output. For non-deterministic variants (`ipcrypt-nd` and `ipcrypt-ndx`), the tweak value is also included.
791-
792767
Key and tweak sizes for each variant:
793768
- `ipcrypt-deterministic`: Key: 16 bytes (128 bits), no tweak
794769
- `ipcrypt-nd`: Key: 16 bytes (128 bits), Tweak: 8 bytes (64 bits)
795770
- `ipcrypt-ndx`: Key: 32 bytes (256 bits, two AES-128 keys), Tweak: 16 bytes (128 bits)
796771

772+
# Implementation Status
773+
774+
*This section is to be removed before publishing as an RFC.*
775+
776+
This section records the status of known implementations of the protocol defined by this specification at the time of posting of this Internet-Draft, and is based on a proposal described in {{!RFC7942}}. The description of implementations in this section is intended to assist the Independent Submissions Editor in judging whether the specification is suitable for publication.
777+
778+
Please note that the listing of any individual implementation here does not imply endorsement. Furthermore, no effort has been spent to verify the information presented here that was supplied by contributors. This is not intended as, and must not be construed to be, a catalog of available implementations or their features.
779+
780+
Multiple interoperable implementations of the schemes described in this document have been developed:
781+
782+
- C implementation
783+
- D implementation
784+
- Go implementation
785+
- Java implementation (maven package)
786+
- JavaScript/TypeScript implementation (npm package)
787+
- PHP implementation (Composer package)
788+
- Python reference implementation
789+
- Rust implementation (cargo package)
790+
- Zig implementation
791+
- Dart implementation (pub.dev package)
792+
793+
A comprehensive list of implementations and their test results can be found at: https://ipcrypt-std.github.io/implementations/
794+
795+
All implementations pass the common test vectors specified in this document, demonstrating interoperability across programming languages.
796+
797+
--- back
798+
799+
# Test Vectors {#test-vectors}
800+
801+
This appendix provides test vectors for all three variants of ipcrypt. Each test vector includes the key, input IP address, and encrypted output. For non-deterministic variants (`ipcrypt-nd` and `ipcrypt-ndx`), the tweak value is also included.
802+
803+
Implementations MUST verify their correctness against these test vectors before deployment.
804+
797805
## ipcrypt-deterministic Test Vectors {#ipcrypt-deterministic-test-vectors}
798806

799807
~~~
@@ -857,20 +865,14 @@ Tweak: 21bd1834bc088cd2b4ecbe30b70898d7
857865
Output: 21bd1834bc088cd2b4ecbe30b70898d76089c7e05ae30c2d10ca149870a263e4
858866
~~~
859867

860-
For non-deterministic variants (`ipcrypt-nd` and `ipcrypt-ndx`), the tweak values shown are examples. In practice, tweaks MUST be randomly generated for each encryption operation.
868+
For non-deterministic variants (`ipcrypt-nd` and `ipcrypt-ndx`), the tweak values shown are examples. In practice, tweaks MUST be uniformly random for each encryption operation.
861869

862-
Implementations SHOULD verify their correctness against these test vectors before deployment.
863-
864-
# Alternatives to Random Tweaks {#alternatives-to-random-tweaks}
865-
866-
While this specification recommends the use of uniformly random tweaks for non-deterministic encryption, implementers may consider alternative approaches:
867-
868-
- **Monotonic Counter:** A counter could be used as a tweak, but this is difficult to maintain in distributed systems. If the counter is not encrypted and the tweakable block cipher is not secure against related-tweak attacks, this could enable correlation attacks.
869-
870-
- **UUIDs:** UUIDs (such as UUIDv6 or UUIDv7) could be used as tweaks; however, these would reveal the original timestamp of the logged IP addresses, which may not be desirable from a privacy perspective.
870+
# IANA Considerations
871+
{:numbered="false"}
871872

872-
Although the birthday bound is a concern with random tweaks, the use of random tweaks remains the recommended and most practical approach, offering the best tradeoffs for most real-world use cases.
873+
This document does not require any IANA actions.
873874

874875
# Acknowledgments
876+
{:numbered="false"}
875877

876878
The author gratefully acknowledges the contributions and insightful comments from members of the IETF independent stream community and the broader cryptographic community that have helped shape this specification.

0 commit comments

Comments
 (0)