Package org.shredzone.acme4j.toolbox
Class JoseUtilsTest
java.lang.Object
org.shredzone.acme4j.toolbox.JoseUtilsTest
Unit tests for
JoseUtils
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
assertExternalAccountBinding
(String serialized, URL resourceUrl, String keyIdentifier, SecretKey macKey, String macAlg) Asserts that the serialized external account binding is valid.void
testCreateExternalAccountBinding
(String keyAlg, String macAlg) Test if an external account binding is correctly created.void
Test if a JOSE ACME Key-Change request is correctly created.void
Test if a JOSE ACME POST-as-GET request is correctly created.void
Test if a JOSE ACME POST request is correctly created.void
Test if JWK structure is correctly converted to public key.void
Test if MAC key algorithms are properly detected.void
Test if ECDSA using NIST P-256 curve and SHA-256 keys are properly detected.void
Test if ECDSA using NIST P-384 curve and SHA-384 keys are properly detected.void
Test if ECDSA using NIST P-521 curve and SHA-512 keys are properly detected.void
Test if public key is correctly converted to JWK structure.void
Test if RSA using SHA-256 keys are properly detected.void
Test if thumbprint is correctly computed.
-
Constructor Details
-
JoseUtilsTest
public JoseUtilsTest()
-
-
Method Details
-
testCreateJosePostRequest
Test if a JOSE ACME POST request is correctly created.- Throws:
Exception
-
testCreateJosePostAsGetRequest
Test if a JOSE ACME POST-as-GET request is correctly created.- Throws:
Exception
-
testCreateJoseKeyChangeRequest
Test if a JOSE ACME Key-Change request is correctly created.- Throws:
Exception
-
testCreateExternalAccountBinding
@ParameterizedTest @CsvSource({"SHA-256,HS256","SHA-384,HS384","SHA-512,HS512","SHA-512,HS256"}) public void testCreateExternalAccountBinding(String keyAlg, String macAlg) throws Exception Test if an external account binding is correctly created.- Throws:
Exception
-
testPublicKeyToJWK
Test if public key is correctly converted to JWK structure.- Throws:
Exception
-
testJWKToPublicKey
Test if JWK structure is correctly converted to public key.- Throws:
Exception
-
testThumbprint
Test if thumbprint is correctly computed.- Throws:
Exception
-
testRsaKey
Test if RSA using SHA-256 keys are properly detected.- Throws:
Exception
-
testP256ECKey
Test if ECDSA using NIST P-256 curve and SHA-256 keys are properly detected.- Throws:
Exception
-
testP384ECKey
Test if ECDSA using NIST P-384 curve and SHA-384 keys are properly detected.- Throws:
Exception
-
testP521ECKey
Test if ECDSA using NIST P-521 curve and SHA-512 keys are properly detected.- Throws:
Exception
-
testMacKey
Test if MAC key algorithms are properly detected.- Throws:
Exception
-
assertExternalAccountBinding
public static void assertExternalAccountBinding(String serialized, URL resourceUrl, String keyIdentifier, SecretKey macKey, String macAlg) Asserts that the serialized external account binding is valid. Unit test fails if the account binding is invalid.
-