Class AbstractJWSUtils

java.lang.Object
eu.europa.esig.jws.AbstractJWSUtils
Direct Known Subclasses:
JAdESUtils, JWSUtils

public abstract class AbstractJWSUtils extends Object
Abstract class for JWS signature validation against JSON schemas
  • Constructor Details

    • AbstractJWSUtils

      protected AbstractJWSUtils()
      Default constructor instantiating the object with null values
  • Method Details

    • getJWSSchema

      public org.everit.json.schema.Schema getJWSSchema()
      Returns a JWS Schema for a root signature element validation
      Returns:
      Schema for JWS root validation
    • getJWSProtectedHeaderSchema

      public org.everit.json.schema.Schema getJWSProtectedHeaderSchema()
      Returns a JWS Protected Header Schema
      Returns:
      Schema for JWS Protected Header validation
    • getJWSUnprotectedHeaderSchema

      public org.everit.json.schema.Schema getJWSUnprotectedHeaderSchema()
      Returns a JWS Protected Header Schema
      Returns:
      Schema for JWS Protected Header validation
    • getJWSSchemaJSON

      public abstract org.json.JSONObject getJWSSchemaJSON()
      Returns a JSON schema for a root JWS element validation
      Returns:
      JSONObject
    • getJWSSchemaDefinitions

      public abstract Map<URI,org.json.JSONObject> getJWSSchemaDefinitions()
      Returns a map of definition objects used for JWS validation
      Returns:
      JWS schema definitions map
    • getJWSProtectedHeaderSchemaJSON

      public abstract org.json.JSONObject getJWSProtectedHeaderSchemaJSON()
      Loads JSON schema for a JSON Protected Header validation
      Returns:
      JSONObject
    • getJWSProtectedHeaderSchemaDefinitions

      public abstract Map<URI,org.json.JSONObject> getJWSProtectedHeaderSchemaDefinitions()
      Returns a map of definition objects used for JWS Protected Header validation
      Returns:
      JWS Protected Header schema definitions map
    • getJWSUnprotectedHeaderSchemaJSON

      public abstract org.json.JSONObject getJWSUnprotectedHeaderSchemaJSON()
      Loads JSON schema for a JSON Unprotected Header validation
      Returns:
      JSONObject
    • getJWSUnprotectedHeaderSchemaDefinitions

      public abstract Map<URI,org.json.JSONObject> getJWSUnprotectedHeaderSchemaDefinitions()
      Returns a map of definition objects used for JWS Unprotected Header validation
      Returns:
      JWS Unprotected Header schema definitions map
    • validateAgainstJWSSchema

      public List<String> validateAgainstJWSSchema(InputStream is)
      Validates a JSON against JWS Schema according to RFC 7515
      Parameters:
      is - InputStream representing a JSON to validate
      Returns:
      a list of String messages containing errors occurred during the validation process, empty list when validation succeeds
    • validateAgainstJWSSchema

      public List<String> validateAgainstJWSSchema(String jsonString)
      Validates a JSON against JWS Schema according to RFC 7515
      Parameters:
      jsonString - String representing a JSON to validate
      Returns:
      a list of String messages containing errors occurred during the validation process, empty list when validation succeeds
    • validateAgainstJWSSchema

      public List<String> validateAgainstJWSSchema(org.json.JSONObject json)
      Validates a JSON against JWS Schema according to RFC 7515
      Parameters:
      json - JSONObject representing a JSON to validate
      Returns:
      a list of String messages containing errors occurred during the validation process, empty list when validation succeeds
    • validateAgainstJWSProtectedHeaderSchema

      public List<String> validateAgainstJWSProtectedHeaderSchema(InputStream is)
      Validates a "protected" header of a JWS
      Parameters:
      is - InputStream representing a protected header of a JWS
      Returns:
      a list of String messages containing errors occurred during the validation process, empty list when validation succeeds
    • validateAgainstJWSProtectedHeaderSchema

      public List<String> validateAgainstJWSProtectedHeaderSchema(String jsonString)
      Validates a "protected" header of a JWS
      Parameters:
      jsonString - String representing a protected header of a JWS
      Returns:
      a list of String messages containing errors occurred during the validation process, empty list when validation succeeds
    • validateAgainstJWSProtectedHeaderSchema

      public List<String> validateAgainstJWSProtectedHeaderSchema(org.json.JSONObject json)
      Validates a "protected" header of a JWS
      Parameters:
      json - JSONObject representing a protected header of a JWS
      Returns:
      a list of String messages containing errors occurred during the validation process, empty list when validation succeeds
    • validateAgainstJWSUnprotectedHeaderSchema

      public List<String> validateAgainstJWSUnprotectedHeaderSchema(InputStream is)
      Validates an unprotected "header" of a JWS
      Parameters:
      is - InputStream representing an unprotected header of a JWS
      Returns:
      a list of String messages containing errors occurred during the validation process, empty list when validation succeeds
    • validateAgainstJWSUnprotectedHeaderSchema

      public List<String> validateAgainstJWSUnprotectedHeaderSchema(String jsonString)
      Validates an unprotected "header" of a JWS
      Parameters:
      jsonString - String representing an unprotected header of a JWS
      Returns:
      a list of String messages containing errors occurred during the validation process, empty list when validation succeeds
    • validateAgainstJWSUnprotectedHeaderSchema

      public List<String> validateAgainstJWSUnprotectedHeaderSchema(org.json.JSONObject json)
      Validates an unprotected "header" of a JWS
      Parameters:
      json - JSONObject representing an unprotected header of a JWS
      Returns:
      a list of String messages containing errors occurred during the validation process, empty list when validation succeeds
    • validateAgainstSchema

      public List<String> validateAgainstSchema(org.json.JSONObject json, org.everit.json.schema.Schema schema)
      Validates a json against the provided JSON schema
      Parameters:
      json - JSONObject to be validated against a schema
      schema - Schema schema to validate against
      Returns:
      a list of String messages containing errors occurred during the validation process, empty list when validation succeeds
    • parseJson

      public org.json.JSONObject parseJson(String json)
      Parses the JSON string and returns a JSONObject
      Parameters:
      json - String to parse
      Returns:
      JSONObject
    • parseJson

      public org.json.JSONObject parseJson(InputStream inputStream)
      Parses the JSON InputStream and returns a JSONObject
      Parameters:
      inputStream - InputStream to parse
      Returns:
      JSONObject
    • loadSchema

      public org.everit.json.schema.Schema loadSchema(org.json.JSONObject schemaJSON, Map<URI,org.json.JSONObject> definitions)
      Loads schema with the given list of definitions (references)
      Parameters:
      schemaJSON - JSONObject the schema object
      definitions - a map containing definitions and their reference names
      Returns:
      Schema