Format-preserving encryption for Spring Boot — auto-configured starter powered by Cyphera.
Built on io.cyphera:cyphera from Maven Central.
Add the dependency:
<dependency>
<groupId>io.cyphera</groupId>
<artifactId>cyphera-spring-boot-starter</artifactId>
<version>VERSION</version>
</dependency>Add cyphera.json to your classpath, inject CypheraClient, and protect data:
@Autowired
private CypheraClient cyphera;
String protectedSsn = cyphera.protect("123-45-6789", "ssn");
// → "T01i6J-xF-07pX" (header-prefixed, dashes preserved)
String accessed = cyphera.access(protectedSsn);
// → "123-45-6789"mvn package -DskipTestsdocker build -t cyphera-spring .- Add the Maven dependency to your Spring Boot project
- Place
cyphera.jsonon the classpath (e.g.src/main/resources/cyphera.json) - Spring auto-configures
CypheraClient— inject it anywhere
# application.yml
cyphera:
configuration-file: classpath:cyphera.json
# configuration-file: file:/etc/cyphera/cyphera.json # external file@Autowired
private CypheraClient cyphera;
// Protect — the named configuration determines engine, alphabet, key
String protectedValue = cyphera.protect("123-45-6789", "ssn");
// → "T01i6J-xF-07pX"
// Access — header-driven, no configuration name needed
String original = cyphera.access(protectedValue);
// → "123-45-6789"
// Access with explicit configuration (escape hatch for headerless configurations)
String original = cyphera.access(protectedValue, "ssn");
// Direct SDK access for advanced use
Cyphera sdk = cyphera.sdk();| Method | Description |
|---|---|
protect(value, configuration) |
Protect using a named configuration |
access(protectedValue) |
Access using the embedded header (primary) |
access(protectedValue, configuration) |
Access with explicit configuration name (escape hatch) |
sdk() |
Access the underlying Cyphera SDK instance |
- Default location:
classpath:cyphera.json - Override with
cyphera.configuration-fileinapplication.yml - Supports
classpath:,file:, and absolute paths - Configuration changes require application restart
- Bean creation logged at startup — check for
CypheraAutoConfigurationin logs - Errors throw
RuntimeException— handle in your application error handling
- Bump the
cyphera-spring-boot-starterversion inpom.xml - Rebuild and redeploy your application
- Bean not created — check that
cyphera.jsonexists on the classpath - "Unknown configuration" — configuration name doesn't match cyphera.json
- "No matching header" — the protected value doesn't start with a known header
{
"configurations": {
"ssn": { "engine": "ff1", "key_ref": "my-key", "header": "T01" },
"credit_card": { "engine": "ff1", "key_ref": "my-key", "header": "T02" }
},
"keys": {
"my-key": { "material": "2B7E151628AED2A6ABF7158809CF4F3C" }
}
}- JPA
AttributeConverterfor transparent field-level encryption on entities - Dynamic configuration reload without restart
- Actuator health indicator for Cyphera status
- Spring Security integration for role-based access policies
Apache 2.0 — Copyright 2026 Horizon Digital Engineering LLC