Implementing the SSLCallback object
There are four callback functions.
|
Function |
When |
|---|---|
|
GetCertificateLabel |
Called when the client application has |
|
GetCredentialAttribute |
Called when the client application has These attributes are used when the client application has set |
|
GetPin |
Called if the PKCS11 token is not logged |
|
TrustVerify |
Called when the server’s internal TrustVerify can be invoked when you are |
Each of these functions is implemented by the SSLCallback
class and has a default implementation. You need to implement any
function for which you want to use the callback. For sample implementations
of each function, see the PowerScript Reference or
the online Help.
To implement the SSLCallBack class:
-
Select Standard Class from the PBObject
page of the New dialog box. -
Select SSLCallback in the Select Standard Class
Type dialog box and click OK. -
Code a callback function to provide the user with
information about the session and prompt the user to return the
required authentication information. -
Repeat step 3 for any other callback functions
you want to implement.
Default implementations
If you do not provide an implementation, or if your implementation
returns an empty string, the default implementation of the callback
is used.
For both GetCertificateLabel and GetCredentialAttribute,
the argument list includes an array of string values that are valid
return values for the callback. The default implementation of these
callbacks throws an exception if the array is empty, and returns
the first value in the array if it exists. As a result, the connection
process continues if the first value in the array is acceptable
to the server, but fails if the value is unacceptable.
For TrustVerify, the default implementation
rejects the current connection.
Handling exceptions
Your implementation of GetPin, GetCertificateLabel,
and GetCredentialAttribute should allow users
to cancel the connection if they are unable to provide the requested
information. You can do this by throwing an exception in your implementation
of the function and catching it in a try-catch block that surrounds
the call to ConnectToServer. Exceptions thrown
in any of the callback functions raise the CTSSecurity::UserAbortedException
exception. You should add any exceptions that can be thrown by the
function to the throws clause of the function’s prototype.