Class ImportKeySpec
Object
ImportKeySpec
ImportKeySpec
is a streamlined DTO used by integrators to import an
existing cryptographic key (public, private or both) into Anka
Secure without exposing the full OpenAPI class.
It purposefully mirrors just the subset of attributes that callers typically
control: kid, kty, alg, publicKey, privateKey,
keyOps, exportable, expiry metadata and usage limits
.
Lifecycle
- The caller populates an instance, leaving
modelVersion
untouched (optional). AnkaSecureSdk#importKey
serialises the instance to JSON and invokes POST /keys/import.- The service validates the JSON, persists the material in a secure
HSM-backed store and returns a
201 Created
status.
Thread-safety & mutability
This class is not immutable; it is intended for request building only. Do not share a mutable instance across threads once handed to the SDK.Example
ImportKeySpec spec = new ImportKeySpec()
.setKid("partner-rsa-2025")
.setKty("RSA")
.setAlg("RSA-2048")
.setPublicKey(rsaPubPem)
.setPrivateKey(rsaPrivPem)
.setKeyOps(List.of("encrypt","decrypt","sign","verify"))
.setExportable(Boolean.TRUE)
.setExpiresAt(ZonedDateTime.parse("2030-12-31T23:59:59Z"))
.setMaxUsageLimit(100_000);
sdk.importKey(spec);
- Since:
- 1.0
- Author:
- Javier Galindo
-
Constructor Details
-
ImportKeySpec
public ImportKeySpec()
-
-
Method Details
-
getModelVersion
-
setModelVersion
-
getKid
-
setKid
-
getKty
-
setKty
-
getAlg
-
setAlg
-
getPublicKey
-
setPublicKey
-
getPrivateKey
-
setPrivateKey
-
getKeyOps
-
setKeyOps
-
getExportable
-
setExportable
-
getExpiresAt
-
setExpiresAt
-
getSoftLimitExpiration
-
setSoftLimitExpiration
-
getMaxUsageLimit
-
setMaxUsageLimit
-
getSoftUsageLimit
-
setSoftUsageLimit
-