Class InstanceReportUtils
java.lang.Object
com.jalios.jcms.admin.instancereport.InstanceReportUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringcomputeFingerprint(PublicKey publicKey) static FilecreateTempFile(String prefix, String suffix, String content) static com.fasterxml.jackson.databind.node.ObjectNodecreateValueWithAttributeNode(com.fasterxml.jackson.databind.ObjectMapper mapper, Object value, String attributeName, Object attributeValue) static StringencryptJson(String jsonContent, PublicKey recipientPublicKey) Encrypts the instance report for the recipient: an ephemeral X25519 key pair is generated for this sending, a shared secret is computed (ECDH) with the recipient public key, the AES-256 key is derived from the shared secret with HKDF-SHA256, the JSON is encrypted with AES-256-GCM. The recipient computes the same shared secret with its private key and the ephemeral public key of the envelope.static PublicKeyloadPublicKey(File pemFile) Loads the X25519 public key of the recipient from a PEM file (PUBLIC KEY block), e.g.static voidputIfNotNull(com.fasterxml.jackson.databind.node.ObjectNode node, String fieldName, String value) static voidputLocaleIfNotNull(com.fasterxml.jackson.databind.node.ObjectNode node, String fieldName, Locale locale) static voidputZoneIdIfNotNull(com.fasterxml.jackson.databind.node.ObjectNode node, String fieldName, ZoneId zoneId)
-
Method Details
-
createValueWithAttributeNode
-
putIfNotNull
-
putZoneIdIfNotNull
-
putLocaleIfNotNull
-
createTempFile
- Throws:
IOException
-
loadPublicKey
Loads the X25519 public key of the recipient from a PEM file (PUBLIC KEY block), e.g. generated with: openssl genpkey -algorithm X25519 | openssl pkey -pubout -
encryptJson
public static String encryptJson(String jsonContent, PublicKey recipientPublicKey) throws InstanceReportEncryptionException Encrypts the instance report for the recipient:- an ephemeral X25519 key pair is generated for this sending,
- a shared secret is computed (ECDH) with the recipient public key,
- the AES-256 key is derived from the shared secret with HKDF-SHA256,
- the JSON is encrypted with AES-256-GCM.
-
computeFingerprint
public static String computeFingerprint(PublicKey publicKey) throws InstanceReportEncryptionException
-