CADP For Java WebServices APIGuide
CADP For Java WebServices APIGuide
CADP For Java WebServices APIGuide
Java - WebServices
USER GUIDE
Revision History
Revision Date Reason
Disclaimer
All information herein is either public information or is the property of and owned solely by Thales
and/or its subsidiaries or affiliates who shall have and keep the sole right to file patent applications or
any other kind of intellectual property protection in connection with such information.
Nothing herein shall be construed as implying or granting to you any rights, by license, grant or
otherwise, under any intellectual and/or industrial property rights of or concerning any of Thales’s
information.
This document can be used for informational, non-commercial, and personal use only provided that:
> The copyright notice below, the confidentiality and proprietary legend and this full warning notice
appear in all copies.
> This document shall not be posted on any publicly accessible network computer or broadcast in any
media and no modification of any part of this document shall be made.
Use for any other purpose is expressly prohibited and may result in severe civil and criminal liabilities.
The information contained in this document is provided “AS IS” without any warranty of any kind.
Unless otherwise expressly agreed in writing, Thales makes no warranty as to the value or accuracy
of information contained herein.
The document could include technical inaccuracies or typographical errors. Changes are periodically
added to the information herein. Furthermore, Thales reserves the right to make any change or
improvement in the specifications data, information, and the like described herein, at any time.
Thales hereby disclaims all warranties and conditions with regard to the information contained herein,
including all implied warranties of merchantability, fitness for a particular purpose, title and non-
infringement. In no event shall Thales be liable, whether in contract, tort or otherwise, for any indirect,
special or consequential damages or any damages whatsoever including but not limited to damages
Disclaimer .......................................................................................................................................................... 2
PREFACE.............................................................................................................................. 7
Release Notes .................................................................................................................................................... 7
Audience ............................................................................................................................................................ 7
Document Conventions ...................................................................................................................................... 7
Command Syntax and Typeface Conventions ............................................................................................... 7
Notifications and Alerts ................................................................................................................................... 8
Related Document ............................................................................................................................................. 9
Support Contacts ............................................................................................................................................. 10
Customer Support Portal .............................................................................................................................. 10
Telephone Support ....................................................................................................................................... 10
Email Support ............................................................................................................................................... 10
This guide describes how to use the WebServices for CipherTrust Data Application Protection for Java
(CADP for Java). The WebServices include SOAP and Rest APIs.
Release Notes
The Customer Release Notes (CRN) document provides important information about this release that is not
included in other customer documentation. It is strongly recommended that you read the CRN to fully
understand the capabilities, limitations, and known issues for this release.
Audience
This document is intended for personnel responsible for maintaining your organization's security
infrastructure. This includes security officers, the key manager administrators, and network administrators. It
is assumed that the users of this document are proficient with security concepts.
All products manufactured and distributed by Thales are designed to be installed, operated, and maintained
by personnel who have the knowledge, training, and qualifications required to safely perform the tasks
assigned to them. The information, processes, and procedures contained in this document are intended for
use by trained and qualified personnel only.
Document Conventions
This section describes the conventions used in this document.
Convention Description
italic The italic attribute is used for emphasis or to indicate a related document. (See the
Installation Guide for more information.)
Double quote marks Double quote marks enclose references to other sections within the document.
<variable> In command descriptions, angle brackets represent variables. You must substitute a
value for command line arguments that are enclosed in angle brackets.
Tips
Tips are used to highlight information that helps to complete a task more efficiently.
TIP: This is some information that will allow you to complete your task more efficiently.
Notes
Notes are used to highlight important or helpful information.
Cautions
Cautions are used to alert you to important information that may help prevent unexpected results or data loss.
CAUTION! Exercise caution. Contains important information that may help prevent
unexpected results or data loss.
Warnings
Warnings are used to alert you to the potential for catastrophic data loss or personal injury.
Related Document
> CipherTrust Application Data Protection for Java User Guide
> CipherTrust Application Data Protection – Customer Release Notes
NOTE: You require an account to access the Customer Support Portal. To create a new
account, go to the portal and click the REGISTER link.
Telephone Support
The support portal also lists telephone numbers for voice contact (Contact Us).
Email Support
You can also contact technical support by email at technical.support.DIS@thalesgroup.com.
CipherTrust Application Data Protection for Java (CADP for Java) WebServices provide an interface to the
capabilities of the Key Manager’s key management and cryptographic operations platform. A very thorough
set of operations are provided which include: key creation, pseudo random number generation, import and
export of key and certificate, encrypt, decrypt, hashing, signing and hash/sign verification. Access to keys and
cryptographic operations are centrally controlled and audited via the Key Manager GUI.
CADP for Java WebServices are deployed on Apache Tomcat 9 utilizing the CADP for Java provider, which
enables interaction between the WebService and Key Manager. Both session oriented and stateless
interfaces are provided to all capabilities via SOAP and REST protocols. When using the session oriented
APIs, the session context must be established and maintained by the HTTP session during access to the
appliances, and closed upon termination of the session. The stateless API requires credentials with every
invocation and there is no common context between each call. It is also possible to combine access to both
session oriented and stateless API wherever suitable as calls to the stateless API do not affect the active
sessions.
Authentication to the WebService is controlled by Key Manager credentials stored within the appliances and
optional Active Directory (AD) domain entities. This allows the accommodation of WebService specific
credentials in combination with access by AD verified authorizations as is most suitable for each application.
All WebService’s users are represented in the Key Manager as cryptographic users and the WebService
access is controlled and audited by the user authorizations defined within Key Manager.
CADP for Java WebService is built to run on an existing Apache Tomcat installation. Since you may want to
install Tomcat just to test the product, this chapter includes the basic installation procedures and some
troubleshooting tips to get the web server running. These instructions should not be used to create a secure,
professional, efficient or production-ready web server. These instructions are here to give you a quick way to
test our Thales product.
These instructions were tested using Apache Tomcat 9.0.4. The results may vary.
CADP for Java WebService supports Apache Tomcat versions 7, 8, and 9.
Prerequisites
> JRE must be installed and JRE_HOME must be set. Alternatively, you can use JDK and set
JAVA_HOME. Oracle Java 8 (minimum 1.8.0_111), 10, 11 (including OpenJDK and Amazon Corretto), 12
(OpenJDK and Azul Java), 14 (OpenJDK), 15 (OpenJDK), 17 (OpenJDK) and IBM Java 8 (minimum
8.0.6.25) are supported.
> Tomcat must be installed, for details refer to http://tomcat.apache.org/
Installation
To install REST API:
• Copy protectappws.war, from the CADP_for_JAVA\lib\webservices directory to the
%CATALINA_HOME%\webapps directory. If Tomcat is running, it may automatically extract the
contents to the %CATALINA_HOME%\webapps\protectappws.
The CADP for Java WebService provides both: session oriented and stateless (SOAP and REST) interfaces
to Key Manager cryptographic facilities. All session oriented access must be enclosed between
Session_Open and Session_Close calls, while all stateless calls are autonomous and do not require any
setup or closing context. For repeated operations it is most efficient to utilize the session based API as it has
the capability to limit repeated interactions with the Key Manager by caching information and cryptographic
objects for reuse within the same session.
Session affinity is managed through maintenance of an “HTTP” session scope. This allows the potential for
both SOAP and REST interfaces to use session oriented access should that be desirable. The CADP for
Java WebService is configured to use “transport session” scope which establishes an HTTP session cookie
that the client must return with all interaction with the web server in order to enable access to the same
session.
The APIs provided in CADP for Java WebService can be run over both http and https protocols. The following
section describes how to configure the HTTPS support.
Note: CADP for Java also allows you to create a NAE session using domain user. For
more details, refer to Session Management Tasks on Thalesdocs.
Input Parameters:
> groupName – name of the group to which users are to be added.
> UserList – list of users to be added to the group. Users may be one or many.
Input Parameters:
none
Input Parameters:
> certname – name of the certificate to export.
> certformat – this option is required if private key is also to be exported along with the certificate. Valid
values: 1 or 8, representing PEM-PKCS#1 or PEM-PKCS#8 format.
Output: Certificate and the optional private key in PKCS#1 or PKCS#8 format
<ns1:Session_Cert_ExportResponse xmlns:ns1="http://dsws.org/protectappws/">-----BEGIN CERTIFICATE--
---MIIDvzCCAqegAwIBAgIDAJ5EMA0GCSqGSIb3DQEBCwUAMIGbMQswCQYDVQQGEwJV
[… sample truncated for brevity … ]
OcqQnevrP4rbUC/5W6+gO0m5ZjMDKryAyW4RiNCboGKtVTVcz68J0+75RTvycjWKibEI-----END
CERTIFICATE-----</ns1:Session_Cert_ExportResponse>
Input Parameters:
> certname – name of the certificate to import.
> certisdeletable – sets whether the certificate can be deleted via the API, default is false.
> certisexportable – sets whether the certificate can be exported via the API, default is false.
> certificate – certificate to be imported, in PKCS1, PKCS#8, or PKCS#12 format.
> certpassword – optional, if password provided certificate must be Hex encoded.
Input Parameters:
> userName
> password
> isPasswordChangeable – optional.
Input Parameters:
none
Output: boolean – if a session was found it is closed, if no session found returns false
<ns1:Session_CloseResponse
xmlns:ns1="http://dsws.org/protectappws/">true</ns1:Session_CloseResponse>
Input Parameters:
> groupName – name of the group to be created.
Input Parameters:
> userName – name of the new user to be created.
> userPassword – password for the new user.
> isPasswordChangeable – optional, use this parameter to change the password. The default value is
false
> CustomAttributeList – optional, use this parameter to add custom attributes to the user.
Input Parameters:
> keyname – name of the key to be used for decryption.
> ciphertext – encrypted data represented in Hex.
> keyiv – optional/blank. If blank, use the key’s default IV, else, specify in Hex characters. The number of
Hex character must be specific to the transformation used.
> transformation – transformation to be used. For example: AES/ ECIES/CBC/PKCS5Padding. For more
information on supported ECIES transformations, refer to the CipherTrust Application Data Protection for
Java User Guide.
> outputformat – optional, displays output in following formats: HEX, STR, and BASE64. Default is STR.
Input Parameters:
> groupName – name of the group to be deleted.
Input Parameters:
> userName – name of the user to be deleted.
Input Parameters:
> keyname – name of the key to be used for encryption.
> plaintext – ASCII text to be encrypted, or hex if binary encryption is desired.
> keyiv – optional/blank. If blank, use the key’s default IV, else, specify in Hex characters. The number of
Hex character must be specific to the transformation used.
> transformation – transformation to be used. For example: AES/ ECIES/CBC/PKCS5Padding. For more
information on supported ECIES transformations, refer to the CipherTrust Application Data Protection for
Java User Guide.
NOTE: In almost all cases the keyiv and transformation should not be
specified: It is a useful practice to utilize the Key Manager capability to
store the IV for the application and AES/CBC/PKCS5Padding – the
default - is the most recommended cipher block mode.
Input Parameters:
> ciphertext- encrypted data
> keyname – name of the key to be used for decryption.
> keyiv – optional, Hex encoded 56 bytes if plaintext > 56 Numeric value.
> tweakAlgo – optional, default is none.
> tweakData – If tweak data algorithm is "None" or absent, the value must be HEX encoded string
representing 64 bit long (hence, HEX encoding will consume 16 characters). Tweak data is mandatory if
Tweak Algo is given, else it is optional.
Input Parameters:
> plaintext – data to be encrypted.
> keyname – name of the key.
> keyiv – optional, Hex encoded 56 bytes if plaintext > 56 Numeric value.
> tweakAlgo – optional, default is none.
> tweakData – If tweak data algorithm is "None" or absent, the value must be HEX encoded string
representing 64 bit long (hence, HEX encoding will consume 16 characters). Tweak data is mandatory if
Tweak Algo is given, else it is optional.
Input Parameters:
> format – format of the ciphertext to be preserved. Valid values are: LAST_FOUR, FIRST_SIX,
FIRST_SIX_LAST_FOUR, FIRST_TWO_LAST_FOUR, and NONE. Also, only the format which was used
for encryption, can be used here for decryption.
> keyName – name of the key.
> transformation – override the standard padding.
> data – data to be decrypted.
> tweakData – optional, If tweak data algorithm is "None" or absent, the value must be HEX encoded string
representing 64 bit long (hence, HEX encoding will consume 16 characters). Tweak data is mandatory if
Tweak Algo is given else it is optional.
> tweakAlgo – optional, default is none.
Input Parameters:
> format – the format in which some part of input data is to be kept intact, that is, the selected part of the
input data is not encrypted. Valid values are: LAST_FOUR, FIRST_SIX, FIRST_SIX_LAST_FOUR,
FIRST_TWO_LAST_FOUR, and NONE.
> keyName – name of the key.
> transformation – override the standard padding.
> data – data to be encrypted.
> tweakData – optional, If tweak data algorithm is "None" or absent, the value must be HEX encoded string
representing 64 bit long (hence, HEX encoding will consume 16 characters). Tweak data is mandatory if
Tweak Algo is given, else it is optional.
> tweakAlgo – optional, default is none.
Input Parameters:
> keyname – name of the key to be used for decryption.
> ciphertext – encrypted data represented in Hex.
> iv – specify 1 to 16 bytes IV in Hex format. For example 697473617265616c6c79636f6f6c6976.
> aad – optional/blank, the data to be passed to the recipient in plain text, needs to be “authenticated”.
> authtaglength – the tag length to ensure the data is not accidentally altered, must be 32 to 128 bits and
must be multiple of 8.
Input Parameters:
> keyname – name of the key to be used for encryption.
> plaintext – ASCII text to be encrypted, or hex if binary encryption is desired.
> iv – specify 1 to 16 bytes IV in Hex format. For example 697473617265616c6c79636f6f6c6976..
> aad – optional/blank, the data to be passed to the recipient in plain text, needs to be “authenticated”.
> authtaglength – the tag length to ensure the data is not accidentally altered, must be 32 to 128 bits and
must be multiple of 8.
Input Parameters:
none
Sample SOAP Parameters:
<prot:Session_GetAllGroupInfo/>
Input Parameters:
> groupName – name of the group for which information is to be retrieved.
Input Parameters:
> keyName – name of the key for which custom attributes are to be retrieved.
Input Parameters:
> username – name of the user for which keys are to be retrieved.
> password – password of the user for which keys are to be retrieved.
Output:
<ns2:GetKeyNamesResponse xmlns:ns2="http://dsws.org/protectappws/">[vijans_aes_128_nv,
vijans_aes_128_v,....< …sample truncated for brevity…>...,
vijans_aes_128_persistent_v]</ns2:GetKeyNamesResponse>
Input Parameters:
> keyname – name of the key to be used for HMAC.
> messagetext – data on which HMAC is to be performed.
Input Parameters:
> keyname – name of the key to be used for HMAC.
> messagetext – data on which HMAC is to be performed.
> mac – message authentication code for verification.
Input Parameters:
> keyname – name of the key to export.
NOTE: When exporting private EC keys, the key format must be set to
PEM-SEC1 or PEM-PKCS#8.
Output: Key bytes in Hex for AES Keys and HMAC keys, PEM encoded for RSA keys
<ns1:Session_Key_ExportResponse
xmlns:ns1="http://dsws.org/protectappws/">68711F03ABEE8B460509D5D54E7C70D3A78ABE21572746D3
1C433A797093B2CC</ns1:Session_Key_ExportResponse>
Output: Key bytes in Hex for AES Keys and HMAC keys, PEM encoded for RSA keys
<ns2:Session_Key_ExportResponse xmlns:ns2="http://dsws.org/protectappws/">
-----BEGIN PRIVATE KEY-----
MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMouxpL4GPXv09+T
mqwo354Ck08uFJPfSFLdAf+8VjOnTTBSkZuVdj2HLO7DOLsgev5Z4goetQ+YY3Th
GM0veDSIoTZSkZhf341pHSp5hi4/a4uMu/uMfz/Gf5U2jselYduU+AyOG3Pyu1Uw
Input Parameters:
> keyname – name of the new key to be created.
> keyalgorithm – must be one of: RSA-2048, RSA-3072, RSA-4096, AES-128, AES-192, AES-256,
HmacSHA1, HmacSHA256, HmacSHA384, HmacSHA512, EC-secp224k1-225, EC-secp224r1-224, EC-
secp256k1-256, EC-secp384r1-384, EC-secp521r1-521, EC-prime256v1-256, EC-brainpoolP224r1-224,
EC-brainpoolP224t1-224, EC-brainpoolP256r1-256, EC-brainpoolP256t1-256, EC-brainpoolP384r1-384,
EC-brainpoolP384t1-384, EC-brainpoolP512r1-512, and EC-brainpoolP512t1-512.
> keyisdeletable – set if the key will be deletable via the API – boolean, default is false.
> keyisexportable – set if the new key will be exportable via the API – boolean, default is false.
> keyisversioned – set if the new key will be a versioned key – boolean, default is false.
> keytemplate – optional, identify a template to use as a basis for the key generation.
> keyistemplate – optional, set if generating a template rather than a key – boolean, default is false.
Input Parameters:
> keyname – name of the key to import.
> keyalgorithm – options are: AES, RSA, EC, and Hmac.
> keyisdeletable – whether the imported key will be deletable via the API – boolean, default is false.
> keyisexportable – whether the imported key will be exportable via the API – boolean, default is false.
> keybytes – the bytes for key to be imported.
<keybytes>68711F03ABEE8B460509D5D54E7C70D3A78ABE21572746D31C433A797093B2CC
</keybytes>
</prot:Session_Key_Import>
Input Parameters:
> keyName – name of the key for which attributes are to be modified.
> Attribute – list of attribute names and values. The type parameter lets you optionally specify the type for
attribute. The default attribute type is String. The supported attribute types are:
• Date/Time
• Byte String
• Integer
• Long Integer
• Big Integer
• String
• Interval
• Enumeration
• Boolean
Output:
<ns2:Session_ModifyCustomAttributesResponse xmlns:ns2="http://dsws.org/protectappws/">Attributes
added successfully.</ns2:Session_ModifyCustomAttributesResponse>
Input Parameters:
> username
> password
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPassword – optional, is the password for the provided certificate alias.
Input Parameters:
> length – the number of random bytes to be generated.
Input Parameters:
> groupName – name of the group from which user is to be removed.
> UserList – list of users to be removed from the group. Users may be one or many.
Input Parameters:
> keyname – name of RSA key pair containing private key.
> messagetext – message to sign.
> transformation – provide from one of the following: RSA, SHA1withRSA, SHA256withRSA,
SHA384withRSA, SHA512withRSA, SHA1withRSAPSSPadding, SHA256withRSAPSSPadding,
SHA384withRSAPSSPadding, and SHA512withRSAPSSPadding. For complete list of supported
transformations, refer to the Supported Algorithm section of the CADP for Java User Guide.
> saltlength – optional, length of salt to be used for sign operation.
> format – optional, supported signing CMS formats are: cms/detached/der/enveloped, cms/detached/der,
cms/detached/smime/enveloped and cms/detached/smime.
> messageformat – optional, supported message formats: HEX and STR. Default is STR.
Input Parameters:
> keyname – name of RSA or EC key pair containing private key.
> messagetext – message to sign. It must be in the same format as specified in the messageformat
parameter.
> transformation – provide one of the RSA/EC signing transformations supported by CADP for Java.
format – optional, supported signing CMS formats are: cms/detached/der/enveloped, cms/detached/der,
cms/detached/smime/enveloped and cms/detached/smime.
> messageformat – optional, supported message formats: HEX and STR. Default is STR.
Input Parameters:
> keyname – name of RSA key pair containing public key.
messagetext – message for signing verification. .
Input Parameters:
> keyname – name of RSA or EC key pair containing public key.
> messagetext – message for signing verification. It must be in the same format as specified in the
messageformat parameter.
> signature – signature of RSA or EC signing for verification in Hex.
> transformation – provide one of the RSA/EC signverify transformations supported by CADP for Java .
> format – optional, supported signing CMS formats are: cms/detached/der/enveloped, cms/detached/der,
cms/detached/smime/enveloped and cms/detached/smime..
> messageformat – optional, supported message formats: HEX and STR. Default is STR.
> caname – optional, name of the CA used for verifying.
Input Parameters:
> userName – name of the user for whom information is to be retrieved.
Input Parameters:
> keyName – name of the key to export.
> keyUseForWrap – key to be used for wrapping.
> wrapFormatPadding – (optional) padding format to be used for wrapping the key. It is used for
PKCS#1v2.1 and one of the following padding is used: SHA256, SHA384, and SHA512.
Input Parameters:
> adminUser
> adminPassword
> groupName
> UserList
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPassword – optional, is the password for the provided certificate alias.
Input Parameters:
> adminUser
> adminPassword
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPassword – optional, is the password for the provided certificate alias.
Input Parameters:
Output: Certificate and the optional private key in PKCS#1 or PKCS#8 format
<ns1:Cert_ExportResponse xmlns:ns1="http://dsws.org/protectappws/">-----BEGIN CERTIFICATE-----
MIIDvzCCAqegAwIBAgIDAJ5EMA0GCSqGSIb3DQEBCwUAMIGbMQswCQYDVQQGEwJV
[… sample truncated for brevity … ]
OcqQnevrP4rbUC/5W6+gO0m5ZjMDKryAyW4RiNCboGKtVTVcz68J0+75RTvycjWK
ibEI
-----END CERTIFICATE-----</ns1:Cert_ExportResponse>
Input Parameters:
> username
Input Parameters:
> userName
> password
> caName
> noOfExpireDays
> csrRequest
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPassword – optional, is the password for the provided certificate alias.
response:
{
"CertificateSigningResponse": {
"signedData": "
----BEGIN CERTIFICATE----
MIICyTCCAbGgAwIBAgIDAyLeMA0GCSqGSIb3DQEBCwUAMIGYMQswCQYDVQQGEwJV
----END CERTIFICATE----
"
}
}
Input Parameters:
> adminUser
> adminPassword
> userName
> userPassword
Input Parameters:
> userName
> password
> keyName – RSA key.
> cnName – common name for the certificate.
> countryName – two letter code of the country.
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPassword – optional, is the password for the provided certificate alias.
Input Parameters:
> adminUser
> adminPassword
> groupName – name of the group to be created.
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPassword – optional, is the password for the provided certificate alias.
Input Parameters:
> adminUser
> adminPassword
> userName
> userPassword
> isPasswordChangeable – optional. Use this parameter to change the password, default value is false.
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPassword – optional, is the password for the provided certificate alias.
> CustomAttributeList – optional, use this parameter to add custom attributes to the user.
Input Parameters:
> username
> password
> keyname – name of the key to be used for decryption.
> ciphertext – encrypted data represented in Hex.
> keyiv – optional/blank. If blank, use the key’s default IV, else, specify in Hex characters. The number of
Hex character must be specific to the transformation used.
> transformation – transformation to be used. For example: AES/ ECIES/CBC/PKCS5Padding. For
information on supported ECIES transformations, refer to the CipherTrust Application Data Protection for
Java User Guide.
> outputformat – optional, displays output in following formats: HEX, STR, and BASE64. Default is STR.
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPass – optional, is the password for the provided certificate alias.
NOTE: In almost all cases the keyiv and transformation should not be
specified: It is a useful practice to utilize the Key Manager appliances
capability to store the IV for the application and
AES/CBC/PKCS5Padding – the default - is the most recommended
cipher block mode.
Input Parameters:
> adminUser
> adminPassword
> groupName – name of the group to be deleted.
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPassword – optional, is the password for the provided certificate alias.
Input Parameters:
> adminUser
> adminPassword
> userName
Input Parameters:
> username
> password
> keyname – name of the key to be used for encryption.
> plaintext – ASCII text to be encrypted, or hex if binary encryption is desired.
> keyiv – optional/blank. If blank, use the key’s default IV, else, specify in Hex characters. The number of
Hex character must be specific to the transformation used.
> transformation – transformation to be used. For example: AES/ ECIES/CBC/PKCS5Padding. For
information on supported ECIES transformations, refer to the CipherTrust Application Data Protection for
Java User Guide.
> certAlias – optional, is a client certificate alias for making SSL connections.
NOTE: In almost all cases the keyiv and transformation should not be
specified: It is a useful practice to utilize the Key Manager appliances
capability to store the IV for the application and
AES/CBC/PKCS5Padding – the default - is the most recommended
cipher block mode.
Input Parameters:
> username
> password
> keyname – name of the key.
> keyiv – optional, Hex encoded 56 bytes.
> tweakAlgo – optional, default is none.
> tweakData – If tweak data algorithm is "None" or absent, the value must be HEX encoded string
representing 64 bit long (hence, HEX encoding will consume 16 characters). Tweak data is mandatory if
Tweak Algo is given, else it is optional.
> cipherText – encrypted data represented in Hex.
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPass – optional, is the password for the provided certificate alias.
Input Parameters:
Input Parameters:
> userName
> password
> format – the format in which some part of ciphertext is to be kept intact. Valid values are: LAST_FOUR,
FIRST_SIX, FIRST_SIX_LAST_FOUR, FIRST_TWO_LAST_FOUR, and NONE. Also, only the format
which was used for encryption of the plaintext, can be used here for decryption. Default value is NONE.
> keyName – name of the key to be used for decryption.
> transformation – override the standard padding.
> data – data to be decrypted.
> tweakAlgo – optional, default is none.
> tweakData – optional, If tweak data algorithm is "None" or absent, the value must be HEX encoded string
representing 64 bit long (hence, HEX encoding will consume 16 characters). Tweak data is mandatory if
Tweak Algo is given, else it is optional.
Input Parameters:
> userName
> password
> format – the format in which some part of input data is to be kept intact, that is, the selected part of the
input data is not encrypted. Valid values are: LAST_FOUR, FIRST_SIX, FIRST_SIX_LAST_FOUR,
FIRST_TWO_LAST_FOUR, and NONE. Default value is NONE.
Input Parameters:
> username
> password
> keyname – name of the key.
> authtaglength – tag length to ensure the data is not accidentally altered, must be 32 to 128 bits and must
be multiple of 8.
> iv – specify 1 to 16 bytes IV in Hex format. For example 697473617265616c6c79636f6f6c6976.
> aad – optional, the data to be passed to the recipient in plain text, needs to be “authenticated”.
> ciphertext – optional, encrypted data represented in Hex.
> transformation – optional, override the standard AES/GCM/NoPadding.
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPass – optional, is the password for the provided certificate alias.
Input Parameters:
> username
> password
> keyname – name of the key.
> authtaglength – tag length to ensure the data is not accidentally altered, must be 32 to 128 bits and must
be multiple of 8.
> iv – specify 1 to 16 bytes IV in Hex format. For example 697473617265616c6c79636f6f6c6976.
> aad – optional, the data to be passed to the recipient in plain text, needs to be “authenticated”.
> plaintext – optional, ASCII text to be encrypted, or hex if binary encryption is desired.
{
"Group": "twgGroup",
"UserList": {"User": "twguser"}
}
]}}}
Input Parameters:
> adminUser
> adminPassword
> groupName – name of the group for which information is to be requested.
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPassword – optional, is the password for the provided certificate alias.
Input Parameters:
> userName
> password
> keyName – name of the key for which custom attributes are to be retrieved.
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPassword – optional, is the password for the provided certificate alias.
Output:
<ns2:GetKeyAttributesResponse xmlns:ns2="http://dsws.org/protectappws/">{attr1=123456,
attrw=234567}</ns2:GetKeyAttributesResponse>
Input Parameters:
> username
> password
> keyname – name of the new key to be used for HMAC.
Input Parameters:
> username
> password
> keyname – name of the key to export.
> keyformat – optional, format of the RSA or EC key to export. Valid values: PEM-PKCS#1 (default), PEM-
PKCS#8, and PEM-SEC1.
> keytype – optional, type of the RSA key to export. Valid value: public or private.
NOTE: When exporting private EC keys, the key format must be set to
PEM-SEC1 or PEM-PKCS#8.
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPass – optional, is the password for the provided certificate alias.
Output: Key bytes in Hex for AES Keys and HMAC keys, PEM encoded for RSA keys
<ns2:Key_ExportResponse xmlns:ns2="http://dsws.org/protectappws/">
-----BEGIN PRIVATE KEY-----
MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAJ0YqKNY1BEgctx2
je8QNie25JIHiODsmNqN3gwDRSehWhJB6neFawkslEhCLzTI+uJPcWquRirs2yo3
k9AkqnY1/7FvzcnsRgaPmcN2jolEs+DB8VWEQPMQP1IM/cF11grly5bgIXbHZww5
ZPI+EqyR2fk7UE3wS1GTA2E5ZSDZAgMBAAECgYAgJj+8zhz4NE/NVmXNmt+6WO+G
Awy8Gy9c6tOaWcD5T0gDnIHDXAZ/piPidcj7YHYXgnKPhoLNnhNsHFufqSFJJcLL
+dpm+oLW/6n43prltd8m4Yv5WytbhVzurv/j00hpptaE9qPNOpnqs42+mwMFH9gp
vB6TcbPLTue6nNsiAQJBAMySGeCMpMed8zzd0ojLoFxzn4MVYTzbZcCP8bSHg2+b
jOYLYhn30++f4gSmSrfucnYFfIZiQ1UdkjTJ9S1zr0kCQQDElytcIZjLmSiTsGb0
QWo6ihIMVnCXoF27VEpbsh9siEZHNfDgkKJWw3moZ+FOYBUZ0gOI3sekbnj/pUZl
KZURAkAKdCjYXbeJ79tfL+KzVNyD/PCYzT3j0z5W4cQzOn2P9X30v34q34w4AY6W
OD03OvskZtFfOKRCNDmlcvCRewjpAkAObbHm/yhBuSn7PPUxdCOhzERq12VIG6MF
frg+ZqJbytytmU3mjXb8uzgQnh8xK2ghDwLnZsJsVRdYW/8Aqb6hAkEAg9avKm7B
skk6IC178u3QD2XLSu/G8x0BJwmcr32qNdw7Wg4nK8NlPCLKeyNZ8CWNokTjYilr
nfdWKZiotldtYQ==
-----END PRIVATE KEY-----
</ns2:Key_ExportResponse>
Input Parameters:
> username
> password
request:
{
"Key_Gen": {
"username": "cryptouser",
"password": "safenet123",
"keyname": "TestKey",
"keyalgorithm": "AES-256",
"keyisdeletable": "false",
"keyisexportable": "false",
"keyisversioned": "false",
"keyistemplate": "true"
}
}
response:
{
"KeyGenResponse": { "keyGenResponse": "true" }
}
Input Parameters:
> adminUser – name of the admin user initiating the key ownership change request. The admin user must
also be the key owner.
> adminPassword – password of the admin user.
> userName – name of the new owner of the key.
> keyName – name of the key to be reassigned.
request:
{
" ChangeKeyOwnerRequest": {
"adminUser": "testadmin_original_owner",
Input Parameters:
> username
> password
request:
{
"Get_KeyNames": {
"username": "testuser",
"password": "testpasscode",
}
}
response:
{
"GetKeyNamesResponse": {"keyNames": "[hmacSHA512keyv, ariakeyv,
testaeskeyonce,… <…sample truncated for brevity…>… aesoncekeyv,
aesoncekeyvImport]"}
}
Output: boolean
<ns2:GetKeyNamesResponse xmlns:ns2="http://dsws.org/protectappws/">[ secp256k1_ecc_key_5v,
<…sample truncated for brevity…>,aesoncekeyvImport]</ns2:GetKeyNamesResponse>
Input Parameters:
> userName
> password
> keyName – name of the key to generate its new version.
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPass – optional, is the password for the provided certificate alias.
request:
{
"GenerateKeyVersion" : {
"userName": "NewUser",
"password": "asdf1234",
"keyName": "GenVersionofKey"
}
}
response:
{
"GenerateKeyVersionResponse": {"generateKeyVersionResponse": true}
}
NOTE: Values for all the XML tags are to be provided in the XML
request, even if a particular permission is not to be modified. Example:
enter true for the encrypt parameter even if the group has encryption
permission for the key, as leaving it blank will set the permission to
false.
Input Parameters:
> username
> password
> keyname – name of the key to import.
> keyalgorithm – options are: AES, RSA, EC, and Hmac.
> keyisdeletable – whether the imported key will be deletable via the API – boolean, default is false.
> keyisexportable – whether the imported key will be exportable via the API - boolean, default is false.
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPass – optional, is the password for the provided certificate alias.
> keybytes – the bytes for key to be imported.
<keybytes>68711F03ABEE8B460509D5D54E7C70D3A78ABE21572746D31C433A797093B2CC
</keybytes>
</prot:Key_Import>
Input Parameters:
> username
> password
> keyname – name of RSA key pair containing private key.
> messagetext – message to sign.
> transformation – provide from one of the following: RSA, SHA1withRSA, SHA256withRSA,
SHA384withRSA, SHA512withRSA, SHA1withRSAPSSPadding, SHA256withRSAPSSPadding,
SHA384withRSAPSSPadding, and SHA512withRSAPSSPadding. For complete list of supported
transformations, refer to the Supported Algorithm section in the Signing and Verifying Chapter of the
CADP for Java User Guide.
> saltlength – optional, length of salt to be used for sign operation.
> format – optional, supported signing CMS formats are: cms/detached/der/enveloped, cms/detached/der,
cms/detached/smime/enveloped and cms/detached/smime.
> messageformat – optional, supported message formats: HEX and STR. Default is STR.
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPass – optional, is the password for the provided certificate alias.
> messageformat – optional, supported message formats: HEX and STR. Default is STR.
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPass – optional, is the password for the provided certificate alias.
"password": "admin",
"keyname": "ecc_testkey",
"messagetext": "126352152154",
"transformation": "SHA512withECDSA"
}
}
"1000103081840240021289F54A83BADACC8FD634A7606531204FECCC834AB649C86BF7D4A3612FC101D
FF1BE16E5354406D934A655705D8D13642763EBD4AECA84C283D399E573AA02405EEFEC37FB16D3CFDCB
F8ACE69E55C8A5F9EA224326EEF0FAF32CE2FA0DCBE7C063A572FA2F209D92A022945F1ED75A80B29404
9D499567CBA8D5993962FCC21"
}
}
RSAVerify: Verify the Signature of Message Text Using RSA Public key
URL: <http/https>://<host-name>:<Port>/protectappws/services/rest/rsaVerify
Input Parameters:
> username
CipherTrust Application Data Protection for Java WebServices: User Guide 100
EULA: https://cpl.thalesgroup.com/legal
"signature": "
3082087B06092A864886F70D010703A082086C30820868020100318201C0308201BC0201003081A3
30819B310B3009060355040613025553310B3009060355040813024341311530130603550407130C
526564776F6F64204369747931143012060355040A130B536166656E657420496E63311430120603
55040B130B456E67696E656572696E67311230100603550403140973616D706C655F636131283026
06092A864886F70D010901161973616D706C655F636140736166656E65742D696E632E636F6D0203
00A6E9300D06092A8648
[… sample truncated for brevity … ]
90E82E619499D6A0B54E084540A2B23AEC0E1943738433A0EA0E4FC7DF1449F9E55849302A17180E
4A678F435EF21F638C5A2746250DDDDD73B19953B03DA286ADB4BBDAF9C77EFC4E5032",
"transformation": "SHA1withRSAPSSPadding",
"saltlength": "40"
}
}
response:
{
"RSA_Verify_Response": { "rsaVerifyResponse": "true" }
}
CipherTrust Application Data Protection for Java WebServices: User Guide 101
EULA: https://cpl.thalesgroup.com/legal
<caname>sample_ca</caname>
</prot:RSA_Verify>
SignVerify: Verify the Signature of Message Text Using RSA or EC Public key
URL: <http/https>://<host-name>:<Port>/protectappws/services/rest/SignVerify
Input Parameters:
> username
> password
CipherTrust Application Data Protection for Java WebServices: User Guide 102
EULA: https://cpl.thalesgroup.com/legal
> keyname – name of RSA or EC key pair containing public key.
> messagetext – message for sign verification. It must be in the same format as specified in the
messageformat parameter.
> messageformat – supported message formats: HEX and STR. Default is STR
> signature – signature of RSA or EC signing for verification in Hex.
> transformation – provide one of the RSA/EC signing transformations supported by CADP for Java.
> format – optional, supported signing CMS formats are: cms/detached/der/enveloped, cms/detached/der,
cms/detached/smime/enveloped and cms/detached/smime
{
"SignVerify": {
"username": "admin",
"password": "admin",
"keyname": "ecc_testkey",
"messagetext": "126352152154",
"signature":
"1000103081840240359CBBCDDECC68E423F56B10D151F5F3E6B2C15DE3F250864AAC26A5B8564BDFDC2
22E6172C476D91418959D4889A7DF03C3F5A6423B105D50E76C2061AC9FF602407F8EF0AC0D34C9B71B3
CipherTrust Application Data Protection for Java WebServices: User Guide 103
EULA: https://cpl.thalesgroup.com/legal
F13B58C32A7CF1440607C26FE03F99991FD330BA3B31FB1A1F5ECD602BBA890B073935B4414F5EE242E9
DD8299FADE146210916F2588D",
"transformation": "SHA512withECDSA"
}
}
{
"SignVerify_Response": {
"signVerifyResponse": true
}
}
Input Parameters:
CipherTrust Application Data Protection for Java WebServices: User Guide 104
EULA: https://cpl.thalesgroup.com/legal
> adminUser
> adminPassword
> groupName – group from which user is to be removed.
> UserList – list of the users to be removed.
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPassword – optional, is the password for the provided certificate alias.
Input Parameters:
CipherTrust Application Data Protection for Java WebServices: User Guide 105
EULA: https://cpl.thalesgroup.com/legal
> adminUser
> adminPassword
> userName – user whose information is required.
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPassword – optional, is the password for the provided certificate alias.
CipherTrust Application Data Protection for Java WebServices: User Guide 106
EULA: https://cpl.thalesgroup.com/legal
Input Parameters:
> userName
> password
> keyName – name of the key to export.
> keyUseForWrap – key to be used for wrapping.
> wrapFormatPadding – (optional) padding format to be used for wrapping the key. It is used for
PKCS#1v2.1 and one of the following padding is used: SHA256, SHA384, and SHA512.
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPassword – optional, is the password for the provided certificate alias.
CipherTrust Application Data Protection for Java WebServices: User Guide 107
EULA: https://cpl.thalesgroup.com/legal
Input Parameters:
> username
> password
> keyname
> keyalgorithm – Del.
> keyisdeletable
> keyisexportable
> keyisversioned
> keytemplate
> keyistemplate
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPass – optional, is the password for the provided certificate alias.
CipherTrust Application Data Protection for Java WebServices: User Guide 108
EULA: https://cpl.thalesgroup.com/legal
Input Parameters:
> username
> password
> KeyName – name of the key for which attributes are to be modified.
> Attribute – name and value of the attribute for the key. The type parameter lets you optionally specify the
type for attribute. The default attribute type is String. Following are the supported attribute types:
• Date/Time
• Byte String
• Integer
• Long Integer
• Big Integer
• String
• Interval
• Enumeration
• Boolean
> certAlias – optional, is a client certificate alias for making SSL connections.
> certPassword – optional, is the password for the provided certificate alias.
CipherTrust Application Data Protection for Java WebServices: User Guide 109
EULA: https://cpl.thalesgroup.com/legal
{
"name": "attr2",
"value": " 7468616c657367656d616c746f",
"type" : "Byte String"
}
]
}
}
}
response:
{"ModifyCustomAttributesResponse": {"result": "Attributes added successfully."}}
Sample SOAP Parameters:
<prot:ModifyCustomAttributes>
<username>test1</username>
<password>abcd1234</password>
<keyName>testaeskey</keyName>
<!--1 or more repetitions:-->
<Attribute>
<name>testattr</name>
<value>124567</value>
<!--Optional:-->
<type>Integer</type>
</Attribute>
</prot:ModifyCustomAttributes>
Output:
<ns2:ModifyCustomAttributesResponse xmlns:ns2="http://dsws.org/protectappws/">Attributes added
successfully.</ns2:ModifyCustomAttributesResponse>
CipherTrust Application Data Protection for Java WebServices: User Guide 110
EULA: https://cpl.thalesgroup.com/legal
AddSecretData: Add KMIP Secret Data to Key Manager
URL: <http/https>://<host-name>:<Port>/protectappws/services/rest/kmip/addSecretData
Input Parameters:
> certAlias – is a client certificate alias for making SSL connections.
> certPass – is the password for the provided certificate alias.
> secretData – secret data to be added to the Key Manager.
> dataType – type of secret data being added to Key Manager. Valid values are Password and Seed. It is
an optional parameter. If no value is provided, default value Password is used.
> secretDataName – name for the secret data being added to Key Manager.
CipherTrust Application Data Protection for Java WebServices: User Guide 111
EULA: https://cpl.thalesgroup.com/legal
GetSecretData: Retrieve KMIP Secret Data from Key Manager
URL: <http/https>://<host-name>:<Port>/protectappws/services/rest/kmip/getSecretData
Input Parameters:
> certAlias – is a client certificate alias for making SSL connections.
> certPass – is the password for the provided certificate alias.
> dataType – type of data being retrieved from Key Manager. Valid values are Password and Seed. It is an
optional parameter.
> secretDataName – name for the secret data being retrieved from Key Manager.
> UID – unique identification number for the secret data being retrieved. UID is generated when the secret
data is added to the Key Manager.
CipherTrust Application Data Protection for Java WebServices: User Guide 112
EULA: https://cpl.thalesgroup.com/legal
{
"GetSecretDataRequest": {
"certAlias": "privatekey",
"certPassword": "asdf1234",
"dataType": "Password",
"UID": "09B5A600CF2B84EEE87A294750536FDCD66442122817BE"
}
}
response:
{
"GetSecretDataResponse": {
"secretDataResponse":
"2E1717D057F2BA2CBA7F6EFF6D37F846CE2848C92C1A0BCBF4F4D3011304BD57"
}
}
CipherTrust Application Data Protection for Java WebServices: User Guide 113
EULA: https://cpl.thalesgroup.com/legal
CHAPTER 4: CADP for Java Mobile App
Samples
Overview
CADP for Java Mobile App is an android based application. It is integration between CADP for Java
WebServices and android application.
Installation
To install CADP for Java Mobile App follow the steps below:
1. Download the protectapp.apk file from the latest CADP for Java build and copy the apk to your android
mobile handset.
2. Run the protectapp.apk setup to install the CADP for Java Mobile App.
CipherTrust Application Data Protection for Java WebServices: User Guide 114
EULA: https://cpl.thalesgroup.com/legal
3. Click Install to start the installation. The following screen appears displaying installation in progress:
CipherTrust Application Data Protection for Java WebServices: User Guide 115
EULA: https://cpl.thalesgroup.com/legal
To start using the mobile app, configure the mobile app.
5. On SETTINGS tab, add the following configuration:
• Host Address – IP address of the server.
• Port – Port of the server.
• User Name – Username to connect to the server.
• Password – Password to connect to the server.
CipherTrust Application Data Protection for Java WebServices: User Guide 116
EULA: https://cpl.thalesgroup.com/legal
6. Click Save to save the configuration.
NOTE: Version with all: When you append #all in the key name, the system
performs encryption of the plaintext with all the available versions of the key.
CipherTrust Application Data Protection for Java WebServices: User Guide 117
EULA: https://cpl.thalesgroup.com/legal
3. Click Submit. The encrypted ciphertext output is displayed in a pop-up message box.
CipherTrust Application Data Protection for Java WebServices: User Guide 118
EULA: https://cpl.thalesgroup.com/legal
Decryption with Mobile App
To decrypt a plaintext with mobile app, follow the steps below:
1. On the android mobile handset, run the CADP for Java application.
2. On the DECRYPT tab, enter the following details:
• Type_Decrypt – Input data type.
• Algorithm – Algorithm to be used for decryption.
• Key Name – Name of the key to be used for decryption.
• IV – optional, a random data. It should be same that was used to encrypt the plaintext.
• Encrypt Text – The ciphertext data to be decrypted.
3. Click Submit. The decrypted plaintext output is displayed in a pop-up message box.
CipherTrust Application Data Protection for Java WebServices: User Guide 119
EULA: https://cpl.thalesgroup.com/legal
4. Click Copy to copy the plaintext or click Cancel to end.
CipherTrust Application Data Protection for Java WebServices: User Guide 120
EULA: https://cpl.thalesgroup.com/legal