Class SecureData

  • java.lang.Object
    • com.thingworx.security.encryption.SecureData

  • @ThingworxExtensionApiClass(since={6,6},
                                canInstantiate=true)
    public final class SecureData
    extends java.lang.Object
    Though we moved all this logic into the Security Library this class has to be maintained because it has extension API annotations. TW-7844 Added canInstantiate = true. Classes with this comment were affected by the TW-7844 bug fix to remove an undesired default constructor, other classes that did not explicitly set canInstantiate = true were affected and will be further analyzed at another time but presently will be set to canInstantiate = true so not to remove possible functionality from the SDK.
    • Constructor Detail

      • SecureData

        public SecureData()
    • Method Detail

      • encryptBase64

        @Deprecated
        @ThingworxExtensionApiMethod(since={6,6},
                                     deprecatedSince={8,3})
        public static java.lang.String encryptBase64​(java.lang.String key,
                                                     java.lang.String data)
                                              throws java.lang.Exception
        Deprecated.


        Return a Base64 encoded encrypted data using the specified key, which is a 56 hex characters string.
        Parameters:
        key - Encryption key that is a 56 hex characters string
        data - The plain text data to be encrypted
        Returns:
        Base64 encoded encrypted data
        Throws:
        java.lang.Exception - emit errors
      • decryptBase64

        @Deprecated
        @ThingworxExtensionApiMethod(since={6,6},
                                     deprecatedSince={8,3})
        public static java.lang.String decryptBase64​(java.lang.String key,
                                                     java.lang.String data)
                                              throws java.lang.Exception
        Deprecated.


        Returns decrypted data using the specified key, which is a 56 hex characters string.
        Parameters:
        key - Decryption key that is a 56 hex characters string
        data - Base64 encoded encrypted data
        Returns:
        The decrypted data
        Throws:
        java.lang.Exception - emit errors
      • encryptWithCustomKey

        @ThingworxExtensionApiMethod(since={8,3})
        public static byte[] encryptWithCustomKey​(byte[] keyBytes,
                                                  byte[] dataBytes)
                                           throws java.lang.Exception
        Throws:
        java.lang.Exception - If an error occurs
      • decryptWithCustomKey

        @ThingworxExtensionApiMethod(since={8,3})
        public static byte[] decryptWithCustomKey​(byte[] keyBytes,
                                                  byte[] dataBytes)
                                           throws java.lang.Exception
        Throws:
        java.lang.Exception - If an error occurs
      • encrypt

        @Deprecated
        @ThingworxExtensionApiMethod(since={6,6},
                                     deprecatedSince={8,3})
        public static byte[] encrypt​(java.lang.String key,
                                     byte[] data)
                              throws java.lang.Exception
        Deprecated.


        Encrypt data in bytes using the specified key
        Parameters:
        key - Encryption key to use (56 hex characters)
        data - Data to be encrypted
        Returns:
        Encrypted bytes
        Throws:
        java.lang.Exception - emit errors
      • encrypt

        @ThingworxExtensionApiMethod(since={6,6})
        public static byte[] encrypt​(byte[] key,
                                     byte[] iv,
                                     byte[] data)
                              throws java.lang.Exception
        Throws:
        java.lang.Exception - If an error occurs
      • decrypt

        @Deprecated
        @ThingworxExtensionApiMethod(since={6,6},
                                     deprecatedSince={8,3})
        public static byte[] decrypt​(java.lang.String key,
                                     byte[] data)
                              throws java.lang.Exception
        Deprecated.


        Decrypt the encrypted data bytes using the specified key
        Parameters:
        key - Decryption key to use (56 hex characters)
        data - Encrypted data in bytes
        Returns:
        Decrypted data in bytes
        Throws:
        java.lang.Exception - emit errors
      • decrypt

        @ThingworxExtensionApiMethod(since={6,6})
        public static byte[] decrypt​(byte[] key,
                                     byte[] iv,
                                     byte[] data)
                              throws java.lang.Exception
        Throws:
        java.lang.Exception - If an error occurs