You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: draft-denis-ipcrypt.md
+69-67Lines changed: 69 additions & 67 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -117,9 +117,9 @@ informative:
117
117
118
118
--- abstract
119
119
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.
121
121
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.
123
123
124
124
--- middle
125
125
@@ -159,7 +159,7 @@ These specialized encryption methods unlock several critical use cases:
159
159
160
160
- **Seamless Third-Party Integration:** Encrypted IPs can act as privacy-preserving identifiers when interacting with untrusted services, cloud providers, or external platforms.
161
161
162
-
For implementation guidelines and practical examples, see {{pseudocode-and-examples}}.
162
+
For implementation guidelines and practical examples, see {{implementation-details}}.
163
163
164
164
## Relationship to IETF Work
165
165
@@ -246,7 +246,7 @@ Implementers MUST choose a cipher that meets the required security properties an
246
246
247
247
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.
248
248
249
-
For implementation details, see {{pseudocode-and-examples}}.
249
+
For implementation details, see {{implementation-details}}.
250
250
251
251
## ipcrypt-deterministic
252
252
@@ -291,7 +291,7 @@ To ensure IPv4 format preservation, implementers MUST consider using cycle-walki
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}}.
295
295
296
296
## Encryption Process
297
297
@@ -356,6 +356,16 @@ As with `ipcrypt-nd`, an `(input, tweak)` collision reveals repetition without c
356
356
- **`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.
357
357
- **`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.
358
358
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
+
359
369
# Security Considerations
360
370
361
371
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
392
402
393
403
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.
*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.
398
408
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}
400
410
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.
402
412
403
-
Multiple interoperable implementations of the schemes described in this document have been developed:
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}}.
@@ -509,10 +492,6 @@ This appendix provides visual representations of the key operations described in
509
492
32-Byte Output (ipcrypt-ndx)
510
493
~~~
511
494
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
-
516
495
## IPv4 Address Conversion
517
496
518
497
For a diagram of this conversion process, see {{ipv4-address-conversion-diagram}}.
@@ -680,15 +659,15 @@ function ipcrypt_ndx_decrypt(ciphertext, key):
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.
686
665
687
-
## Overview
666
+
### Overview
688
667
689
668
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.
690
669
691
-
## Tweak Padding
670
+
### Tweak Padding
692
671
693
672
The 8-byte tweak is padded to 16 bytes using the following method:
Each round of KIASU-BC consists of the following standard AES operations:
709
688
@@ -714,15 +693,15 @@ Each round of KIASU-BC consists of the following standard AES operations:
714
693
715
694
For details about these operations, see {{FIPS-197}}.
716
695
717
-
## Key Schedule
696
+
### Key Schedule
718
697
719
698
The key schedule follows the standard AES-128 key expansion:
720
699
721
700
1. The initial key is expanded into 11 round keys
722
701
2. Each round key is XORed with the padded tweak before use
723
702
3. The first round key is used in the initial AddRoundKey operation
724
703
725
-
## Implementation Steps
704
+
### Implementation Steps
726
705
727
706
1. **Key Expansion:**
728
707
- 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:
744
723
- ShiftRows
745
724
- AddRoundKey (with tweaked round key)
746
725
747
-
## Example Implementation
726
+
### Example Implementation
748
727
749
728
The following pseudocode illustrates the core operations of KIASU-BC:
750
729
@@ -785,15 +764,44 @@ function kiasu_bc_encrypt(key, tweak, plaintext):
785
764
return state
786
765
~~~
787
766
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
-
792
767
Key and tweak sizes for each variant:
793
768
- `ipcrypt-deterministic`: Key: 16 bytes (128 bits), no tweak
*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:
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
+
797
805
## ipcrypt-deterministic Test Vectors {#ipcrypt-deterministic-test-vectors}
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.
861
869
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"}
871
872
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.
873
874
874
875
# Acknowledgments
876
+
{:numbered="false"}
875
877
876
878
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