The Cipher service uses the Automation Orchestrator encryption algorithms to encrypt and decrypt strings. You can use this service when a plug-in stores sensitive data.

Procedure

  1. Access the service.
    1. If the plug-in is Spring-enabled:
      //Object must be declared in the spring context
      public class MyDomainObject {
      
       @Autowired
       private ICipher cipherService;
      }
    2. If the plug-in is not Spring-enabled:
      public class PluginAdaptor implements IServiceRegistryAdaptor {
       private IServiceRegistry registry;
       private ICipher cipherService;
       @Override
       public void setServiceRegistry(IServiceRegistry registry) {
       this.registry = registry;
       }
      
       public ICipher getCipherService() {
       if (cipherService == null) {
       cipherService =
      registry.getService(IServiceRegistry.CIPHER_SERVICE);
       }
       return cipherService;
       }
      }
  2. Invoke the encrypt and decrypt methods.
    public class MyCustomModelClass {
     private ICipher cipherService;
    
     //Encrypts a string
     cipherService.encrypt("text-to-encrypt");
     //Decrypt a vRO encrypted string
     cipherService.decrypt("..."); // the string for decryption
    }
    
    Note: If the decryption fails, it falls back to the legacy decryption algorithm that is available in earlier versions of Automation Orchestrator.