Class SecureData
java.lang.Object
com.thingworx.security.encryption.SecureData
@ThingworxExtensionApiClass(since={6,6},
canInstantiate=true)
public final class SecureData
extends 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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
decrypt
(byte[] key, byte[] iv, byte[] data) static byte[]
Deprecated.static String
decryptBase64
(String key, String data) Deprecated.UsedecryptWithCustomKey(byte[], byte[])
instead.static byte[]
decryptWithCustomKey
(byte[] keyBytes, byte[] dataBytes) static byte[]
encrypt
(byte[] key, byte[] iv, byte[] data) static byte[]
Deprecated.Useencrypt(byte[], byte[], byte[])
instead.static String
encryptBase64
(String key, String data) Deprecated.UseencryptWithCustomKey(byte[], byte[])
instead.static byte[]
encryptWithCustomKey
(byte[] keyBytes, byte[] dataBytes)
-
Constructor Details
-
SecureData
public SecureData()
-
-
Method Details
-
encryptBase64
@Deprecated @ThingworxExtensionApiMethod(since={6,6}, deprecatedSince={8,3}) public static String encryptBase64(String key, String data) throws Exception Deprecated.UseencryptWithCustomKey(byte[], byte[])
instead.
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 stringdata
- The plain text data to be encrypted- Returns:
- Base64 encoded encrypted data
- Throws:
Exception
- emit errors
-
decryptBase64
@Deprecated @ThingworxExtensionApiMethod(since={6,6}, deprecatedSince={8,3}) public static String decryptBase64(String key, String data) throws Exception Deprecated.UsedecryptWithCustomKey(byte[], byte[])
instead.
Returns decrypted data using the specified key, which is a 56 hex characters string.- Parameters:
key
- Decryption key that is a 56 hex characters stringdata
- Base64 encoded encrypted data- Returns:
- The decrypted data
- Throws:
Exception
- emit errors
-
encryptWithCustomKey
@ThingworxExtensionApiMethod(since={8,3}) public static byte[] encryptWithCustomKey(byte[] keyBytes, byte[] dataBytes) throws Exception - Throws:
Exception
- If an error occurs
-
decryptWithCustomKey
@ThingworxExtensionApiMethod(since={8,3}) public static byte[] decryptWithCustomKey(byte[] keyBytes, byte[] dataBytes) throws Exception - Throws:
Exception
- If an error occurs
-
encrypt
@Deprecated @ThingworxExtensionApiMethod(since={6,6}, deprecatedSince={8,3}) public static byte[] encrypt(String key, byte[] data) throws Exception Deprecated.Useencrypt(byte[], byte[], byte[])
instead.
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:
Exception
- emit errors
-
encrypt
@ThingworxExtensionApiMethod(since={6,6}) public static byte[] encrypt(byte[] key, byte[] iv, byte[] data) throws Exception - Throws:
Exception
- If an error occurs
-
decrypt
@Deprecated @ThingworxExtensionApiMethod(since={6,6}, deprecatedSince={8,3}) public static byte[] decrypt(String key, byte[] data) throws Exception Deprecated.Usedecrypt(byte[], byte[], byte[])
instead.
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:
Exception
- emit errors
-
decrypt
@ThingworxExtensionApiMethod(since={6,6}) public static byte[] decrypt(byte[] key, byte[] iv, byte[] data) throws Exception - Throws:
Exception
- If an error occurs
-
decrypt(byte[], byte[], byte[])
instead.