Class MetadataEncryptor


  • public class MetadataEncryptor
    extends java.lang.Object
    Component to convert encrypt/decrypt properties.

    This is a helper; it is up to the client how and when encryption and decryption is done, but metadata integrity enforcement will expect that encrypted properties are already encrypted.

    This class must always be used running as 'system'.

    Since:
    4.0
    Author:
    Derek Hulley
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean backupKeyAvailable​(java.lang.String keyAlias)  
      java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> decrypt​(java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> inbound)
      Decrypt properties if they are decryptable.
      java.io.Serializable decrypt​(org.alfresco.service.namespace.QName propertyQName, java.io.Serializable inbound)
      Decrypt a property if the data definition (model-specific) requires it.
      java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> encrypt​(java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> inbound)
      Encrypt properties if their data definition (model-specific) requires it.
      java.io.Serializable encrypt​(org.alfresco.service.namespace.QName propertyQName, java.io.Serializable inbound)
      Encrypt a properties if the data definition (model-specific) requires it.
      boolean keyAvailable​(java.lang.String keyAlias)  
      void setDictionaryService​(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)  
      void setEncryptor​(org.alfresco.encryption.FallbackEncryptor encryptor)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MetadataEncryptor

        public MetadataEncryptor()
    • Method Detail

      • setDictionaryService

        public void setDictionaryService​(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
        Parameters:
        dictionaryService - service to check if properties need encrypting
      • setEncryptor

        public void setEncryptor​(org.alfresco.encryption.FallbackEncryptor encryptor)
        Parameters:
        encryptor - the class that does the encryption/decryption
      • encrypt

        public java.io.Serializable encrypt​(org.alfresco.service.namespace.QName propertyQName,
                                            java.io.Serializable inbound)
        Encrypt a properties if the data definition (model-specific) requires it.
        Parameters:
        propertyQName - the property qualified name
        inbound - the property to encrypt
        Returns:
        the encrypted property or the original if encryption is not required
      • decrypt

        public java.io.Serializable decrypt​(org.alfresco.service.namespace.QName propertyQName,
                                            java.io.Serializable inbound)
        Decrypt a property if the data definition (model-specific) requires it.
        Parameters:
        propertyQName - the property qualified name
        inbound - the property to decrypt
        Returns:
        the decrypted property or the original if it wasn't encrypted
      • encrypt

        public java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> encrypt​(java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> inbound)
        Encrypt properties if their data definition (model-specific) requires it. The values provided can be mixed; values will be encrypted only if required.
        Parameters:
        inbound - the properties to encrypt
        Returns:
        a new map of values if some encryption occured otherwise the original inbound map is returned
      • decrypt

        public java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> decrypt​(java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> inbound)
        Decrypt properties if they are decryptable. The values provided can be mixed; encrypted values will be sought out and decrypted.
        Parameters:
        inbound - the properties to decrypt
        Returns:
        a new map of values if some decryption occured otherwise the original inbound map is returned
      • keyAvailable

        public boolean keyAvailable​(java.lang.String keyAlias)
      • backupKeyAvailable

        public boolean backupKeyAvailable​(java.lang.String keyAlias)