public sealed class CryptoReplaceFfxFpeConfig : IMessage<CryptoReplaceFfxFpeConfig>, IEquatable<CryptoReplaceFfxFpeConfig>, IDeepCloneable<CryptoReplaceFfxFpeConfig>, IBufferMessage, IMessage
Reference documentation and code samples for the Google Cloud Data Loss Prevention v2 API class CryptoReplaceFfxFpeConfig.
Replaces an identifier with a surrogate using Format Preserving Encryption
(FPE) with the FFX mode of operation; however when used in the
ReidentifyContent API method, it serves the opposite function by reversing
the surrogate back into the original identifier. The identifier must be
encoded as ASCII. For a given crypto key and context, the same identifier
will be replaced with the same surrogate. Identifiers must be at least two
characters long. In the case that the identifier is the empty string, it will
be skipped. See
https://cloud.google.com/sensitive-data-protection/docs/pseudonymization to
learn more.
Note: We recommend using CryptoDeterministicConfig for all use cases which
do not require preserving the input alphabet space and size, plus warrant
referential integrity. FPE incurs significant latency costs.
The 'tweak', a context may be used for higher security since the same
identifier in two different contexts won't be given the same surrogate. If
the context is not set, a default tweak will be used.
If the context is set but:
there is no record present when transforming a given value or
the field is not present when transforming a given value,
a default tweak will be used.
Note that case (1) is expected when an InfoTypeTransformation is
applied to both structured and unstructured ContentItems.
Currently, the referenced field may be of value type integer or string.
The tweak is constructed as a sequence of bytes in big endian byte order
such that:
a 64 bit integer is encoded followed by a single byte of value 1
a string is encoded in UTF-8 format followed by a single byte of value 2
This is supported by mapping these to the alphanumeric characters
that the FFX mode natively supports. This happens before/after
encryption/decryption.
Each character listed must appear only once.
Number of characters must be in the range [2, 95].
This must be encoded as ASCII.
The order of characters does not matter.
The full list of allowed characters is:
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~`!@#$%^&*()_-+={[}]|\:;"'<,>.?/
The custom infoType to annotate the surrogate with.
This annotation will be applied to the surrogate by prefixing it with
the name of the custom infoType followed by the number of
characters comprising the surrogate. The following scheme defines the
format: info_type_name(surrogate_character_count):surrogate
For example, if the name of custom infoType is 'MY_TOKEN_INFO_TYPE' and
the surrogate is 'abc', the full replacement value
will be: 'MY_TOKEN_INFO_TYPE(3):abc'
This annotation identifies the surrogate when inspecting content using the
custom infoType
SurrogateType.
This facilitates reversal of the surrogate when it occurs in free text.
In order for inspection to work properly, the name of this infoType must
not occur naturally anywhere in your data; otherwise, inspection may
find a surrogate that does not correspond to an actual identifier.
Therefore, choose your custom infoType name carefully after considering
what your data looks like. One way to select a name that has a high chance
of yielding reliable detection is to include one or more unicode characters
that are highly improbable to exist in your data.
For example, assuming your data is entered from a regular ASCII keyboard,
the symbol with the hex code point 29DD might be used like so:
⧝MY_TOKEN_TYPE
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe provided content details the \u003ccode\u003eCryptoReplaceFfxFpeConfig\u003c/code\u003e class within the Google Cloud Data Loss Prevention v2 API, which facilitates the replacement of identifiers with surrogates using Format Preserving Encryption (FPE) or reverses the surrogate back to the original identifier.\u003c/p\u003e\n"],["\u003cp\u003eThis class, \u003ccode\u003eCryptoReplaceFfxFpeConfig\u003c/code\u003e, is part of the \u003ccode\u003eGoogle.Cloud.Dlp.V2\u003c/code\u003e namespace and is available in multiple versions, ranging from 2.15.0 to the latest 4.16.0, documented via a hyperlink to each specific version.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eCryptoReplaceFfxFpeConfig\u003c/code\u003e class implements several interfaces, including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e, and offers properties such as \u003ccode\u003eCryptoKey\u003c/code\u003e, \u003ccode\u003eContext\u003c/code\u003e, \u003ccode\u003eCommonAlphabet\u003c/code\u003e, and \u003ccode\u003eCustomAlphabet\u003c/code\u003e for configuration.\u003c/p\u003e\n"],["\u003cp\u003eIt's noted that while FPE is used for replacing identifiers with a surrogate, \u003ccode\u003eCryptoDeterministicConfig\u003c/code\u003e is recommended for use cases that do not require preserving the input alphabet space and size.\u003c/p\u003e\n"],["\u003cp\u003eThe class contains constructors, inherited members, and properties that allow for customization, such as specifying the common alphabet or a custom one, setting the context, and selecting a surrogate info type to annotate the surrogate.\u003c/p\u003e\n"]]],[],null,["# Google Cloud Data Loss Prevention v2 API - Class CryptoReplaceFfxFpeConfig (4.19.0)\n\nVersion latestkeyboard_arrow_down\n\n- [4.19.0 (latest)](/dotnet/docs/reference/Google.Cloud.Dlp.V2/latest/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [4.18.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.18.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [4.17.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.17.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [4.16.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.16.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [4.15.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.15.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [4.14.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.14.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [4.13.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.13.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [4.12.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.12.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [4.11.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.11.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [4.10.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.10.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [4.9.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.9.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [4.8.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.8.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [4.7.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.7.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [4.6.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.6.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [4.5.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.5.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [4.4.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.4.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [4.3.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.3.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [4.2.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.2.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [4.1.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.1.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [4.0.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.0.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [3.5.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/3.5.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [3.4.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/3.4.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [3.3.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/3.3.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [3.2.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/3.2.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [2.16.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/2.16.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig)\n- [2.15.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/2.15.0/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig) \n\n public sealed class CryptoReplaceFfxFpeConfig : IMessage\u003cCryptoReplaceFfxFpeConfig\u003e, IEquatable\u003cCryptoReplaceFfxFpeConfig\u003e, IDeepCloneable\u003cCryptoReplaceFfxFpeConfig\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Google Cloud Data Loss Prevention v2 API class CryptoReplaceFfxFpeConfig.\n\nReplaces an identifier with a surrogate using Format Preserving Encryption\n(FPE) with the FFX mode of operation; however when used in the\n`ReidentifyContent` API method, it serves the opposite function by reversing\nthe surrogate back into the original identifier. The identifier must be\nencoded as ASCII. For a given crypto key and context, the same identifier\nwill be replaced with the same surrogate. Identifiers must be at least two\ncharacters long. In the case that the identifier is the empty string, it will\nbe skipped. See\n\u003chttps://cloud.google.com/sensitive-data-protection/docs/pseudonymization\u003e to\nlearn more.\n\nNote: We recommend using CryptoDeterministicConfig for all use cases which\ndo not require preserving the input alphabet space and size, plus warrant\nreferential integrity. FPE incurs significant latency costs. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e CryptoReplaceFfxFpeConfig \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[CryptoReplaceFfxFpeConfig](/dotnet/docs/reference/Google.Cloud.Dlp.V2/latest/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[CryptoReplaceFfxFpeConfig](/dotnet/docs/reference/Google.Cloud.Dlp.V2/latest/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[CryptoReplaceFfxFpeConfig](/dotnet/docs/reference/Google.Cloud.Dlp.V2/latest/Google.Cloud.Dlp.V2.CryptoReplaceFfxFpeConfig), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Dlp.V2](/dotnet/docs/reference/Google.Cloud.Dlp.V2/latest/Google.Cloud.Dlp.V2)\n\nAssembly\n--------\n\nGoogle.Cloud.Dlp.V2.dll\n\nConstructors\n------------\n\n### CryptoReplaceFfxFpeConfig()\n\n public CryptoReplaceFfxFpeConfig()\n\n### CryptoReplaceFfxFpeConfig(CryptoReplaceFfxFpeConfig)\n\n public CryptoReplaceFfxFpeConfig(CryptoReplaceFfxFpeConfig other)\n\nProperties\n----------\n\n### AlphabetCase\n\n public CryptoReplaceFfxFpeConfig.AlphabetOneofCase AlphabetCase { get; }\n\n### CommonAlphabet\n\n public CryptoReplaceFfxFpeConfig.Types.FfxCommonNativeAlphabet CommonAlphabet { get; set; }\n\nCommon alphabets.\n\n### Context\n\n public FieldId Context { get; set; }\n\nThe 'tweak', a context may be used for higher security since the same\nidentifier in two different contexts won't be given the same surrogate. If\nthe context is not set, a default tweak will be used.\n\nIf the context is set but:\n\n1. there is no record present when transforming a given value or\n2. the field is not present when transforming a given value,\n\na default tweak will be used.\n\nNote that case (1) is expected when an `InfoTypeTransformation` is\napplied to both structured and unstructured `ContentItem`s.\nCurrently, the referenced field may be of value type integer or string.\n\nThe tweak is constructed as a sequence of bytes in big endian byte order\nsuch that:\n\n- a 64 bit integer is encoded followed by a single byte of value 1\n- a string is encoded in UTF-8 format followed by a single byte of value 2\n\n### CryptoKey\n\n public CryptoKey CryptoKey { get; set; }\n\nRequired. The key used by the encryption algorithm.\n\n### CustomAlphabet\n\n public string CustomAlphabet { get; set; }\n\nThis is supported by mapping these to the alphanumeric characters\nthat the FFX mode natively supports. This happens before/after\nencryption/decryption.\nEach character listed must appear only once.\nNumber of characters must be in the range \\[2, 95\\].\nThis must be encoded as ASCII.\nThe order of characters does not matter.\nThe full list of allowed characters is:\n``0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~`!@#$%^&*()_-+={[}]|\\:;\"'\u003c,\u003e.?/``\n\n### HasCommonAlphabet\n\n public bool HasCommonAlphabet { get; }\n\nGets whether the \"common_alphabet\" field is set\n\n### HasCustomAlphabet\n\n public bool HasCustomAlphabet { get; }\n\nGets whether the \"custom_alphabet\" field is set\n\n### HasRadix\n\n public bool HasRadix { get; }\n\nGets whether the \"radix\" field is set\n\n### Radix\n\n public int Radix { get; set; }\n\nThe native way to select the alphabet. Must be in the range \\[2, 95\\].\n\n### SurrogateInfoType\n\n public InfoType SurrogateInfoType { get; set; }\n\nThe custom infoType to annotate the surrogate with.\nThis annotation will be applied to the surrogate by prefixing it with\nthe name of the custom infoType followed by the number of\ncharacters comprising the surrogate. The following scheme defines the\nformat: info_type_name(surrogate_character_count):surrogate\n\nFor example, if the name of custom infoType is 'MY_TOKEN_INFO_TYPE' and\nthe surrogate is 'abc', the full replacement value\nwill be: 'MY_TOKEN_INFO_TYPE(3):abc'\n\nThis annotation identifies the surrogate when inspecting content using the\ncustom infoType\n[`SurrogateType`](https://cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/InspectConfig#surrogatetype).\nThis facilitates reversal of the surrogate when it occurs in free text.\n\nIn order for inspection to work properly, the name of this infoType must\nnot occur naturally anywhere in your data; otherwise, inspection may\nfind a surrogate that does not correspond to an actual identifier.\nTherefore, choose your custom infoType name carefully after considering\nwhat your data looks like. One way to select a name that has a high chance\nof yielding reliable detection is to include one or more unicode characters\nthat are highly improbable to exist in your data.\nFor example, assuming your data is entered from a regular ASCII keyboard,\nthe symbol with the hex code point 29DD might be used like so:\n⧝MY_TOKEN_TYPE"]]