007-012400-002 SAS Authentication Java API Developer Guide v3.7 RevG PDF
007-012400-002 SAS Authentication Java API Developer Guide v3.7 RevG PDF
Contents
Preface .................................................................................................................................. 4
Audience ......................................................................................................................................................... 4
Support Contacts ............................................................................................................................................ 4
Customer Support Portal .......................................................................................................................... 4
Telephone Support ................................................................................................................................... 5
Preface
The SafeNet Authentication Service (SAS) Authentication API enables agents to support all functionality
required to interact with the SAS authentication server. SAS agents are third-party applications with embedded
plug-in code that enables the collection of user names and one-time passwords (OTPs) to be passed to the SAS
server for verification.
Audience
This document is intended for personnel responsible for maintaining your organization's security infrastructure. It
is assumed that the users of this document are proficient with security concepts.
All products manufactured and distributed by Gemalto 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.
Support Contacts
If you encounter a problem while installing, registering, or operating this product, refer to the documentation. If
you cannot resolve the issue, contact your supplier or Gemalto Customer Support.
Gemalto Customer Support operates 24 hours a day, 7 days a week. Your level of access to this service is
governed by the support plan arrangements made between Gemalto and your organization. Please consult this
support plan for further information about your entitlements, including the hours when telephone support is
available to you.
NOTE: You require an account to access the Customer Support Portal. To create
a new account, go to the portal and click on the REGISTER link.
Telephone Support
If you have an urgent problem, or cannot access the Customer Support Portal, you can contact Customer
Support by telephone. Calls to Customer Support are handled on a priority basis.
Global +1-410-931-7520
Australia 1800.020.183
France 0800-912-857
Germany 0800-181-6374
India 000.800.100.4290
Israel 180-931-5798
Italy 800-786-421
Netherlands 0800.022.2996
Portugal 800.863.499
Singapore 800.1302.029
Spain 900.938.717
Sweden 020.791.028
Switzerland 0800.564.849
1
SAS Authentication API
The SAS Authentication API is represented by a single Java class, CRYPTOCardAPI. This class is a singleton.
Constructors
CRYPTOCardAPI()
{
// empty constructor
}
getInstance Method
getInstance
(
)
returns a singleton instance of the CRYPTOCardAPI class.
setINIPath Function
setINIPath
(
String path
);
This function may be called to set the location from where the API should load the INI file. If this function is not
called before calling LoadJNILibrary, the INI file will be loaded from:
• Default Deployment Location
• If not persent at default location, the current execution path will be explored.
LoadJNILibrary must be called to initialize this instance.
LoadJNILibrary Method
LoadJNILibrary
(
)
This functions loads and initializes the SafeNet encryption, communication, and logging library from the system-
exported LD_LIBRARY_PATH (on Linux) environment path or the system PATH (on Windows).
This function requires that, on Linux-like systems, the LD_LIBRARY_PATH environment variable be exported,
pointing to the location of all the binaries like libJCryptoWrapper.so. On Linux-like systemd, run ldd
./libJCryptoWrapper.so to confirm that all the dependencies can be resolved.
On Windows Systems, the management tool adds this path to the system’s PATH environment variable, making
it visible to the Java application. But if it is desired to load binaries from a different location (such as multiple
applications using their own binaries), this function should be called with the full path to JCryptoWrapper.dll or
libJCryptoWrapper.so.
On a Linux system, you must add the LD_LIBRARY_PATH export directive in your application`s launch script.
In the case of a web application, this must be declared in the web server launch script.
Read and write permissions must be set on the defined paths before attempting to load the binaries.
LoadJNILibrary
(
String LoadFromLocation
);
This functions loads and initializes the SafeNet encryption, communication, and logging library from the required
location. Call the setINIPath function before calling this function if it is desired to load the INI file from any other
location than the default. Comments for the LoadJNILibrary function without any argument are also valid for
this function call.
Authenticate Method
All authentications related actions make use of a single API call:
Authenticate
(
String[] arrData
);
arrData[9] ErrorMessage Return Value -> Error Message for Logging or client
• BothServersDown – TokenValidator servers are down. If both servers (primary and secondary) are down,
value is 1, otherwise 0.
• InIPAddress – A string representing the IP address from which the authentication request came. If this
parameter is an empty string, the SAS server will attempt to detect the IP from which the authentication
request came from.
VerifySignature Method
Verifies the token's signature for a given hash.
VerifySignature
(
String[] arrData
);
getGridSureGrid Method
The getGridSureGrid method creates and returns a GrIDsure grid from the received SAS challenge.
getGridSureGrid
(
String BSIDChallenge
);
getGridSureLogo Method
getGridSureLogo
(
);
The getGridSureLogo method returns the GrIDsure logo (an instance of the BufferedImage class) from a
string saved in this function.
If the getGridSureLogo method fails, it returns NULL BufferedImage or throws an exception.
2
Use Case Scenarios
SAS architecture supports the concept of a token-side and server-side PIN used in either QuickLog or
challenge/response mode. In addition, agents must support challenges, inner/outer window authentication, and
static password authentication. The following sections discuss these features in more detail.
Basic Authentication
The communication between an SAS agent and server is similar to that used in the RADIUS protocol, in that the
concepts of challenge messages and states are used.
The following scenario shows the most basic interaction between the agent and server:
1. Authenticating agent issues an authentication request with username, organization name, and a passcode.
2. Server responds with one of nine possible return codes as outlined in Returned Result.
Challenge-Response
Central to the concept of challenge/response authentication, outer window authentication, and server-side PIN
changes is a challenge message and state attribute issued from the authenticating server. This mechanism is
employed to authenticate tokens in challenge/response mode in the following manner:
1. Authenticating agent issues an authentication request with username, organization name, and a blank
passcode.
2. Server responds with a challenge message containing a challenge string (for example, challenge:
19863257) and a state attribute.
3. The authenticating agent responds to the challenge by issuing another authentication request with their
username, organization name, a response, and the state attribute.
To support localization, the SAS server returns necessary data only in its challenge messages, and the agent is
required to construct a localized version of it to display to the client. For example, the SAS server would return
only 19863257, and the SAS agent would display “Please respond to the challenge: 19863257”.
2. The server finds a match for the provided OTP in the outer window and issues a challenge to the client
containing an outer window authentication string (“Please re-authenticate using the next OTP from your
token”) and a state attribute.
3. The authenticating agent responds to the challenge by issuing another authentication request with their
username, organization name, a response, and the state attribute.
See the localization note in the section “Challenge-Response” page 11.
PIN Styles
A number of PIN styles in SAS are supported:
• No PIN
• Fixed PIN (token-side PIN validation)
• User-changeable PINs (token-side PIN validation)
• Stored on server, fixed PIN
• Stored on server, user-changeable PIN
• Stored on server, server-changeable PIN
The authentication mechanism in SAS supports incoming passcodes in the following format [PIN+OTP], [OTP],
[NEWPIN], [STATICPASSWORD] and an empty passcode to request a challenge.
Logging
The Java Authentication API will log messages to the log file C:/log/JCcryptoWrapper-{date}.log. This location
is configurable through the JavaAPIManager Logging tab. The logging level can be adjusted through this tab to
warning, info, debug, error, or critical.
3
Additional Information
API Example
Refer to the sample code in Main.java for an example of how to call the Authenticate and VerifySignature
methods.
To use the API example, the following are required:
• BSIDJavaAPI.jar (needed for Windows and Linux)
• NetBeans IDE or Eclipse, or any other Java development tool
Configuration
Configuration of the Java Authentication API is done through the JavaAPIManager.
For configuration on Windows the following files are required:
• Program Files\CRYPTOCard\BlackShield ID\JavaAPI\ JavaAPIManager.exe
• Program Files\CRYPTOCard\BlackShield ID\JavaAPI\Nini.dll