Package com.labs64.netlicensing.util
Class SignatureUtils
java.lang.Object
com.labs64.netlicensing.util.SignatureUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheck(Context context, Netlicensing response) Verify response signature.static voidcheck(Netlicensing response, byte[] publicKeyByteArray) Verify response signature.static StringcleansePublicKey(String publicKey) Cleanse public key; replace CRLF and strip key headersstatic PublicKeyreadPublicKey(byte[] publicKey) Read public key from the byte arraystatic PublicKeyreadPublicKey(String publicKey) Read public key from the string
-
Constructor Details
-
SignatureUtils
public SignatureUtils()
-
-
Method Details
-
cleansePublicKey
Cleanse public key; replace CRLF and strip key headers- Parameters:
publicKey-- Returns:
- cleansed public key
-
readPublicKey
public static PublicKey readPublicKey(byte[] publicKey) throws NoSuchAlgorithmException, InvalidKeySpecException Read public key from the byte array- Parameters:
publicKey-- Returns:
- Throws:
NoSuchAlgorithmExceptionInvalidKeySpecException
-
readPublicKey
public static PublicKey readPublicKey(String publicKey) throws NoSuchAlgorithmException, InvalidKeySpecException Read public key from the string- Parameters:
publicKey-- Returns:
- Throws:
NoSuchAlgorithmExceptionInvalidKeySpecException
-
check
Verify response signature.- Parameters:
context-response-- Throws:
BadSignatureException
-
check
public static void check(Netlicensing response, byte[] publicKeyByteArray) throws jakarta.xml.bind.JAXBException, ParserConfigurationException, SignatureException Verify response signature.- Parameters:
response-publicKeyByteArray-- Throws:
jakarta.xml.bind.JAXBExceptionParserConfigurationExceptionSignatureException
-