Java
SmartField SDK for Java
Decrypt SmartField encrypted data with Java. Works with Spring / HttpServer. Tested on port 6666.
Installation
// javax.crypto included in JDK
Initialize
SmartField sf = new SmartField();
sf.init();
This generates RSA-2048 keys locally. Keys are stored in .smartfield/ and never sent anywhere.
Decrypt
String password = sf.decrypt(encryptedPayload);
That's it. The encrypted payload from the browser is decrypted server-side. Only your server has the private key.
How It Works
- Browser: SmartField encrypts user input with AES-256-GCM
- Browser: AES key is wrapped with your server's RSA-2048 public key
- Network: Encrypted payload sent to your Java server
- Server: RSA private key unwraps the AES key
- Server: AES key decrypts the data
- Server: Plaintext available only here
Frontend Setup
<script src="https://cdn.smartfield.dev/v1/smartfield.js"></script>
<smart-field type="password"
encrypt-key="/api/sf-key"
placeholder="password"></smart-field>
Encryption Details
- Data encryption: AES-256-GCM (NIST SP 800-38D)
- Key exchange: RSA-OAEP-2048 (NIST SP 800-56B)
- Random generation: Cryptographically secure (Web Crypto API)
- Payload format: Base64(JSON{v, iv, key, data})
- New key per encryption: Forward secrecy per keystroke
Related Pages