The g method returns the version of the signature file.
Syntax
Android
public static G g(String c)
iOS
+(g*) g: (NSData*) c
Parameters
Obtain the signature file version parameters lists the parameters for this function:
Parameter name | Data type | Use | Description |
---|---|---|---|
c | String/NSData* | I (mandatory) | Signature file content. |
Return values
This method returns the G response object, which contains the following:
- A return code that indicates the result of the analysis.
- The version of the signature file in case of success.
- An exception if an unknown error occurs.
Exceptions
Obtain the signature file version exceptions lists the possible error codes for this function.
Examples
This section illustrates how to integrate and use the g method to retrieve the signature file version. For more information, refer to the Root Detection SDK sample project in the OneSpan Mobile Security Suite package.
Once deployed, the application will be installed under the name OneSpan Root Detection SDK Sample.
Android
original code example: this works in PDF but doesn't include the copy code feature on the CP:
- // Retrieve the signature file
- InputStream ins = assetManager.open(path);
- // Get signature file version
- G response = P.g(convertInsToString(ins));
- int returnCode = response.r();
- // Check if the version has been successfully retrieved
- if (returnCode == O.n)
- {
- System.out.println("Signature File version " + response.v());
- }
- else
- {
- System.out.println(getMsgFromReturnCode(returnCode));
- System.out.println("Error code: " + returnCode);
- }
MadCap Flare code snippet:
// Retrieve the signature file
InputStream ins = assetManager.open(path);
// Get signature file version
G response = P.g(convertInsToString(ins));
int returnCode = response.r();
// Check if the version has been successfully retrieve
if (returnCode == O.n){
System.out.println("Signature File version " + response.v());
}
else
{
System.out.println(getMsgFromReturnCode(returnCode));
System.out.println("Error code: " + returnCode);
}
Formatted with "pre" tag - this works in CP but not in PDF:
// Retrieve the signature file InputStream ins = assetManager.open(path); // Get signature file version G response = P.g(convertInsToString(ins)); int returnCode = response.r(); // Check if the version has been successfully retrieve if (returnCode == O.n){ System.out.println("Signature File version " + response.v()); } else { System.out.println(getMsgFromReturnCode(returnCode)); System.out.println("Error code: " + returnCode); }
iOS
original code example:
- //Load signature file
- NSString * filePath = [[NSBundlemainBundle] pathForResource:@"signature" ofType:nil];
- //Get NSData from file
- NSData * d = [NSData dataWithContentsOfFile:filePath];
- // Call the g method: check the signature file version
- G response = [P g:d];
- NSString * resultText = @"";
- //Parse result
- switch(response.r){
- case P_n:
- resultText = [NSStringstringWithFormat:@"** Version ** \r ** %s ** ", response.v];
- ...
formatted with <pre>:
//Load signature file NSString * filePath = [[NSBundlemainBundle] pathForResource:@"signature" ofType:nil]; //Get NSData from file NSData * d = [NSData dataWithContentsOfFile:filePath]; // Call the g method: check the signature file version G response = [P g:d]; NSString * resultText = @""; //Parse result switch(response.r){ case P_n: resultText = [NSStringstringWithFormat:@"** Version ** \r ** %s ** ", response.v]; ...