Skip to content

Conversation

alterstep
Copy link
Contributor

@alterstep alterstep commented Sep 10, 2025

Introduce encrypt_ip and decrypt_ip functions to the standard library for cryptographic protection of IP addresses.

Unlike the generic encrypt and decrypt utilities, these functions transform an IP address into another valid IP address, enabling seamless integration in networking contexts.

Two modes are currently supported:

  • aes128: scrambles the entire address. (note: an IPv4 address may become an IPv6 address, and vice versa.)
  • pfx: prefix-preserving mode. Encrypted addresses that share a common prefix will retain that relationship, which supports statistical analysis while still providing confidentiality.

These implementations follow the ipcrypt-deterministic and ipcrypt-pfx methods described in the IPCrypt specification: https://www.ietf.org/archive/id/draft-denis-ipcrypt-11.html

Summary

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

How did you test this PR?

I deployed this in production. The PR also includes tests for that feature.

The code compiles to WebAssembly.

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on
    our guidelines.
  • No. A maintainer will apply the "no-changelog" label to this PR.

Checklist

  • Our CONTRIBUTING.md is a good starting place.
  • If this PR introduces changes to LICENSE-3rdparty.csv, please
    run dd-rust-license-tool write and commit the changes. More details here.
  • For new VRL functions, please also create a sibling PR in Vector to document the new function.

References

I’ll open a sibling PR in the vector repository to add documentation, but I’d like to know first whether the addition of these functions would be accepted.

Introduce `encrypt_ip` and `decrypt_ip` functions to the standard
library for cryptographic protection of IP addresses.

Unlike the generic `encrypt` and `decrypt` utilities, these functions
transform an IP address into another valid IP address, enabling seamless
integration in networking contexts.

Two modes are currently supported:
- `aes128`: scrambles the entire address. An IPv4 address may become
  an IPv6 address, and vice versa.
- `pfx`: prefix-preserving mode. Encrypted addresses that share a
  common prefix will retain that relationship, which supports
  statistical analysis while still providing confidentiality.

These implementations follow the `ipcrypt-deterministic` and
`ipcrypt-pfx` methods described in the IPCrypt specification.
@alterstep alterstep requested a review from a team as a code owner September 10, 2025 22:44
Copy link
Member

@pront pront left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@pront pront enabled auto-merge September 12, 2025 18:28
alterstep added a commit to alterstep/vector that referenced this pull request Sep 12, 2025
Add documentation for the new `encrypt_ip` and `decrypt_ip` VRL functions
that implement format-preserving encryption for IP addresses.

These functions support two modes:
- AES128: Scrambles entire IP address using AES-128 encryption
- PFX: Prefix-preserving mode that maintains network hierarchy

The functions implement the `ipcrypt-deterministic` and `ipcrypt-pfx`
algorithms from the IPCrypt specification.

Related PR: vectordotdev/vrl#1506
auto-merge was automatically disabled September 12, 2025 20:46

Head branch was pushed to by a user without write access

@alterstep
Copy link
Contributor Author

Sibling documentation PR in Vector - Done.

@pront pront enabled auto-merge September 15, 2025 13:11
@pront pront added this pull request to the merge queue Sep 15, 2025
Merged via the queue into vectordotdev:main with commit 5ac8e8b Sep 15, 2025
15 checks passed
alterstep added a commit to alterstep/vector that referenced this pull request Sep 16, 2025
Add documentation for the new `encrypt_ip` and `decrypt_ip` VRL functions
that implement format-preserving encryption for IP addresses.

These functions support two modes:
- AES128: Scrambles entire IP address using AES-128 encryption
- PFX: Prefix-preserving mode that maintains network hierarchy

The functions implement the `ipcrypt-deterministic` and `ipcrypt-pfx`
algorithms from the IPCrypt specification.

Related PR: vectordotdev/vrl#1506
alterstep added a commit to alterstep/vector that referenced this pull request Sep 16, 2025
Add documentation for the new `encrypt_ip` and `decrypt_ip` VRL functions
that implement format-preserving encryption for IP addresses.

These functions support two modes:
- AES128: Scrambles entire IP address using AES-128 encryption
- PFX: Prefix-preserving mode that maintains network hierarchy

The functions implement the `ipcrypt-deterministic` and `ipcrypt-pfx`
algorithms from the IPCrypt specification.

Related PR: vectordotdev/vrl#1506
github-merge-queue bot pushed a commit to vectordotdev/vector that referenced this pull request Sep 17, 2025
* docs(vrl): add documentation for IPCrypt functions

Add documentation for the new `encrypt_ip` and `decrypt_ip` VRL functions
that implement format-preserving encryption for IP addresses.

These functions support two modes:
- AES128: Scrambles entire IP address using AES-128 encryption
- PFX: Prefix-preserving mode that maintains network hierarchy

The functions implement the `ipcrypt-deterministic` and `ipcrypt-pfx`
algorithms from the IPCrypt specification.

Related PR: vectordotdev/vrl#1506

* Add newlines

* update licenses

* update vrl del and rebuild licenses

---------

Co-authored-by: Pavlos Rontidis <[email protected]>
github-merge-queue bot pushed a commit to vectordotdev/vector that referenced this pull request Sep 17, 2025
* docs(vrl): add documentation for IPCrypt functions

Add documentation for the new `encrypt_ip` and `decrypt_ip` VRL functions
that implement format-preserving encryption for IP addresses.

These functions support two modes:
- AES128: Scrambles entire IP address using AES-128 encryption
- PFX: Prefix-preserving mode that maintains network hierarchy

The functions implement the `ipcrypt-deterministic` and `ipcrypt-pfx`
algorithms from the IPCrypt specification.

Related PR: vectordotdev/vrl#1506

* Add newlines

* update licenses

* update vrl del and rebuild licenses

---------

Co-authored-by: Pavlos Rontidis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants