Package com.saxonica.config
Class Verifier
- java.lang.Object
-
- com.saxonica.config.Verifier
-
- Direct Known Subclasses:
JavaVerifier
public abstract class Verifier extends java.lang.Object
A helper class for EnterpriseConfiguration that handles license keys as issued for the Java platform.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
Verifier.License
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
LICENSE_FILE_NAME
protected int
status
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.io.InputStream
connectToURI(java.lang.String uri)
protected static byte[]
convertHexToBinary(java.lang.String hex)
Convert a Hex String into the corresponding byte array by encoding each two hexadecimal digits as a byte.java.lang.String
getFeature(java.lang.String name, Configuration config)
java.util.Properties
getLicenseFeatures(Configuration config)
protected Verifier.License
getPrimaryLicense()
protected abstract void
loadLicense(Configuration config)
Locate the license file, read it, and verify itstatic void
main(java.lang.String[] args)
Test program to verify that a license contained in a specific file is validprotected Verifier.License
readLicenseFile(java.io.InputStream is)
protected void
setPrimaryLicense(Verifier.License license)
protected abstract boolean
verify(java.lang.String data, java.lang.String signature)
This method validates license data based on the signature and the public key.protected abstract boolean
verify2(java.lang.String data, java.lang.String signature)
This method validates license data based on the V2 signature and the public key.
-
-
-
Field Detail
-
status
protected int status
-
LICENSE_FILE_NAME
protected static final java.lang.String LICENSE_FILE_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
setPrimaryLicense
protected void setPrimaryLicense(Verifier.License license)
-
getPrimaryLicense
protected Verifier.License getPrimaryLicense()
-
getFeature
public java.lang.String getFeature(java.lang.String name, Configuration config)
-
getLicenseFeatures
public java.util.Properties getLicenseFeatures(Configuration config)
-
loadLicense
protected abstract void loadLicense(Configuration config)
Locate the license file, read it, and verify it- Parameters:
config
- the Saxon configuration- Throws:
LicenseException
- if, for example, a license is found and is invalid
-
connectToURI
protected java.io.InputStream connectToURI(java.lang.String uri) throws java.io.IOException
- Throws:
java.io.IOException
-
readLicenseFile
protected Verifier.License readLicenseFile(java.io.InputStream is)
-
convertHexToBinary
protected static byte[] convertHexToBinary(java.lang.String hex)
Convert a Hex String into the corresponding byte array by encoding each two hexadecimal digits as a byte.- Parameters:
hex
- Hexadecimal digits representation- Returns:
- byte Byte array
-
verify
protected abstract boolean verify(java.lang.String data, java.lang.String signature) throws LicenseException
This method validates license data based on the signature and the public key.- Parameters:
data
- the license data.signature
- the digital signature- Returns:
- a boolean whether or the license is valid.
- Throws:
LicenseException
- if a failure occurs in the verification process
-
verify2
protected abstract boolean verify2(java.lang.String data, java.lang.String signature) throws LicenseException
This method validates license data based on the V2 signature and the public key.- Parameters:
data
- the license data.signature
- the digital signature- Returns:
- a boolean whether or the license is valid.
- Throws:
LicenseException
- if a failure occurs in the verification process
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception
Test program to verify that a license contained in a specific file is valid- Parameters:
args
- Command line arguments. First argument is the filename of the license file to be tested.- Throws:
java.lang.Exception
- if any failure occurs
-
-