Class InstanceReportUtils

java.lang.Object
com.jalios.jcms.admin.instancereport.InstanceReportUtils

public class InstanceReportUtils extends Object
  • Method Details

    • createValueWithAttributeNode

      public static com.fasterxml.jackson.databind.node.ObjectNode createValueWithAttributeNode(com.fasterxml.jackson.databind.ObjectMapper mapper, Object value, String attributeName, Object attributeValue)
    • putIfNotNull

      public static void putIfNotNull(com.fasterxml.jackson.databind.node.ObjectNode node, String fieldName, String value)
    • putZoneIdIfNotNull

      public static void putZoneIdIfNotNull(com.fasterxml.jackson.databind.node.ObjectNode node, String fieldName, ZoneId zoneId)
    • putLocaleIfNotNull

      public static void putLocaleIfNotNull(com.fasterxml.jackson.databind.node.ObjectNode node, String fieldName, Locale locale)
    • createTempFile

      public static File createTempFile(String prefix, String suffix, String content) throws IOException
      Throws:
      IOException
    • loadPublicKey

      public static PublicKey loadPublicKey(File pemFile) throws InstanceReportEncryptionException
      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
      Throws:
      InstanceReportEncryptionException
    • encryptJson

      public static String encryptJson(String jsonContent, PublicKey recipientPublicKey) throws InstanceReportEncryptionException
      Encrypts the instance report for the recipient:
      1. an ephemeral X25519 key pair is generated for this sending,
      2. a shared secret is computed (ECDH) with the recipient public key,
      3. the AES-256 key is derived from the shared secret with HKDF-SHA256,
      4. 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.
      Throws:
      InstanceReportEncryptionException
    • computeFingerprint

      public static String computeFingerprint(PublicKey publicKey) throws InstanceReportEncryptionException
      Throws:
      InstanceReportEncryptionException