Encryption Functions

Overview

Allows for the encryption and decryption of text data using symmetric AES encryption. This plug-in uses standard Java cryptography functions to expose expression functions for the encryption and decryption of data using AES.

Key Features & Functionality

Functions:

  • encryptvalue(): Encrypt plain text data using an AES encryption key stored in the Secure Credentials Store
  • decryptvalue(): Decrypt encrypted text data using an AES encryption key stored in the Secure Credentials Store

Features:

  • Supports up to 256-bit AES keys when JCE Unlimited Strength Jurisdiction Policy is enabled
  • Backwards compatible with older versions of Java lacking support for >128-bit encryption keys
Anonymous
  • Hello - Can I know what version a JUnit we can use to run the unit tests in the Encryption Functions plugin?

    Also, what version of JDK used to develop?

    I'm getting the following error trying to run the testEncryptedValueCanBeDecrypted test

    internal Error occurred.
    org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-jupiter' failed to discover tests
        at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:160)
        at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverSafely(EngineDiscoveryOrchestrator.java:132)
        at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:107)
        at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:78)
        at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:110)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
        at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
        at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
        at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71)
        at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
        at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
        at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
    Caused by: org.junit.platform.commons.JUnitException: MethodSelector [className = 'com.appiansolutionengineering.encryption.test.EncryptTextTest', methodName = 'testEncryptedValueCanBeDecrypted', methodParameterTypes = ''] resolution failed
        at org.junit.platform.launcher.listeners.discovery.AbortOnFailureLauncherDiscoveryListener.selectorProcessed(AbortOnFailureLauncherDiscoveryListener.java:39)
        at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:103)
        at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.run(EngineDiscoveryRequestResolution.java:83)
        at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolver.resolve(EngineDiscoveryRequestResolver.java:113)
        at org.junit.jupiter.engine.discovery.DiscoverySelectorResolver.resolveSelectors(DiscoverySelectorResolver.java:46)
        at org.junit.jupiter.engine.JupiterTestEngine.discover(JupiterTestEngine.java:69)
        at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:152)
        ... 11 more
    Caused by: org.junit.platform.commons.PreconditionViolationException: Could not load class with name: com.appiansolutionengineering.encryption.test.EncryptTextTest
        at org.junit.platform.engine.discovery.MethodSelector.lambda$lazyLoadJavaClass$0(MethodSelector.java:157)
        at org.junit.platform.commons.function.Try$Failure.getOrThrow(Try.java:335)
        at org.junit.platform.engine.discovery.MethodSelector.lazyLoadJavaClass(MethodSelector.java:156)
        at org.junit.platform.engine.discovery.MethodSelector.getJavaClass(MethodSelector.java:135)
        at org.junit.jupiter.engine.discovery.MethodSelectorResolver.resolve(MethodSelectorResolver.java:75)
        at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.lambda$resolve$2(EngineDiscoveryRequestResolution.java:150)
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
        at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1361)
        at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
        at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
        at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
        at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:189)
        at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:126)
        at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:92)
        ... 16 more
    Caused by: java.lang.ClassNotFoundException: com.appiansolutionengineering.encryption.test.EncryptTextTest
        at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        at org.junit.platform.commons.util.ReflectionUtils.lambda$tryToLoadClass$9(ReflectionUtils.java:831)
        at org.junit.platform.commons.function.Try.lambda$call$0(Try.java:57)
        at org.junit.platform.commons.function.Try.of(Try.java:93)
        at org.junit.platform.commons.function.Try.call(Try.java:57)
        at org.junit.platform.commons.util.ReflectionUtils.tryToLoadClass(ReflectionUtils.java:794)
        at org.junit.platform.commons.util.ReflectionUtils.tryToLoadClass(ReflectionUtils.java:750)
        ... 32 more

  • I know the description above states that this plug-in supports encryption/decryption of plain text data but is there any reason why it would not work on other data types? In particular I'm thinking of date fields, e.g. used for Date Of Birth (I assume the encrypted value would have to be stored as text anyway). Or would you need to convert the date field to text before passing it to the encryptvalue() function?

  • Is there any way to check whether text is already encrypted or not?

  • Hi,

    i am trying to add a validation inside the a!encryptedTextField(), is there a way to add validations?

    there is no parameter for "validation".

    if you suggest that will be helpful.

    a!localVariables(
    local!accountNumber,
    {
    a!encryptedTextField(
    label: "Bank Account Number:",
    labelPosition: "ABOVE",
    value: local!accountNumber,
    saveInto: local!accountNumber,
    refreshAfter: "UNFOCUS",
    required: true,

    ),
    }
    )

  • Hi , glad you got it resolved. You are correct in that using a!encryptedTextField() is only supported with the native encryption APIs using the Appian generated key. The Encryption Functions plug-in needs to always be used with regular text fields and other components.

  • Ok, I got it resolved, it seems we cant use encryptedTextField() when encrypting, it worked with simple textField()

  • I forgot to add that I am using default systemkey and fieldkey for the test purposes.

  • Dear Community,

    I am doing a little test of the Encryption Functions plugin.

    My ultimate target is to encrypt certain text, save it to the database, and be able to decrypt it back on the user interfaces.

    To test the functionality I did a small test. First box is saving encrypted text to the rule input, and second box is decrypting it and show.
    Unfortunately, instead receiving the string 'Test', I am receiving another string of characters to what was saved into the rule input.

    What am I doing wrong ?

    Thank you very much in advance for your help,

    Best Regards,
    Maciej

  • okay, then we have to clarify this with appian. Thank you.

  • , this plug-in is available for install and use in Appian Cloud. Note that all plug-ins are provided as-is and without explicit troubleshooting support from Appian Technical Support, but it is available to install and use in an Appian Cloud environment just like on premise.