Package com.labs64.netlicensing.util
Class SignatureUtils
java.lang.Object
com.labs64.netlicensing.util.SignatureUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
check
(Context context, Netlicensing response) Verify response signature.static void
check
(Netlicensing response, byte[] publicKeyByteArray) Verify response signature.static String
cleansePublicKey
(String publicKey) Cleanse public key; replace CRLF and strip key headersstatic PublicKey
readPublicKey
(byte[] publicKey) Read public key from the byte arraystatic PublicKey
readPublicKey
(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:
NoSuchAlgorithmException
InvalidKeySpecException
-
readPublicKey
public static PublicKey readPublicKey(String publicKey) throws NoSuchAlgorithmException, InvalidKeySpecException Read public key from the string- Parameters:
publicKey
-- Returns:
- Throws:
NoSuchAlgorithmException
InvalidKeySpecException
-
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.JAXBException
ParserConfigurationException
SignatureException
-