Class CryptoContext

java.lang.Object
org.wso2.carbon.crypto.api.CryptoContext

public class CryptoContext extends Object
The class which encapsulated information which is used to find out the correct keys for crypto operations. The context will be interpreted by applicable KeyResolver implementations.
  • Constructor Details

    • CryptoContext

      public CryptoContext(int tenantId, String tenantDomain, String type, String identifier, String purpose, Map<String,String> properties)
      The constructor which accepts all the needed information to create a CryptoContext.
      Parameters:
      tenantId - ID of the tenant which the crypto operations are going to be performed on.
      tenantDomain - Name of the tenant which the crypto operations are going to be performed on.
      type - A name which denotes the type of the context. e.g. SERVICE-PROVIDER
      identifier - An identifier of the context if there is any. e.g. service provider id
      purpose - The purpose of the crypto operations.
      properties - An arbitrary map of context properties.
  • Method Details

    • buildEmptyContext

      public static CryptoContext buildEmptyContext(int tenantId, String tenantDomain)
      Creates and returns a CryptoContext which has no attribute values other than the tenant information.

      This is a convenience method to create a context with minimal information.

      Parameters:
      tenantId -
      tenantDomain -
      Returns:
    • getTenantId

      public int getTenantId()
    • getTenantDomain

      public String getTenantDomain()
    • getType

      public String getType()
    • getIdentifier

      public String getIdentifier()
    • getPurpose

      public String getPurpose()
    • addProperty

      public void addProperty(String propertyName, String propertyValue)
      Adds the given context property value against the given property name. These properties will be interpreted by the applicable KeyResolver
      Parameters:
      propertyName - Name of the property
      propertyValue - Value of the property
    • getProperty

      public String getProperty(String propertyName)
      Returns the context property which has given property name.
      Parameters:
      propertyName - Property name
      Returns:
      The context property which has the given name.
    • toString

      public String toString()
      Overrides:
      toString in class Object