Class HMACSignatureTest
java.lang.Object
org.opensaml.core.testing.OpenSAMLInitBaseTestCase
org.opensaml.core.testing.XMLObjectBaseTestCase
org.opensaml.xmlsec.signature.support.tests.HMACSignatureTest
public class HMACSignatureTest
extends org.opensaml.core.testing.XMLObjectBaseTestCase
Test to verify
Signature and its marshallers and unmarshallers.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringSignature algorithm URI.private CredentialInvalid credential for verification.private StringExpected key name value in KeyInfo.private CredentialCredential used to sign and verify.private IntegerValue of HMACOutputLength element child of SignatureMethod.private XMLObjectBuilder<KeyInfo>Build of KeyInfo objects.private final org.slf4j.LoggerClass logger.private XMLObjectBuilder<Signature>Builder of Signature XML objects.private SignableSimpleXMLObjectBuilderBuilder of mock XML objects.Fields inherited from class org.opensaml.core.testing.XMLObjectBaseTestCase
builderFactory, marshallerFactory, parserPool, simpleXMLObjectQName, unmarshallerFactory -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate SignableSimpleXMLObjectgetXMLObjectWithSignature(boolean useHMACOutputLength) Creates a XMLObject that has a Signature child element.protected voidsetUp()voidTests marshalling with SignatureMethod/HMACOutputLength not present.voidTests marshalling with SignatureMethod/HMACOutputLength present.voidTests creating an enveloped signature and then verifying it.voidTests creating an enveloped signature and then verifying it.voidTests unmarshalling with SignatureMethod/HMACOutputLength not present.voidTests unmarshalling with SignatureMethod/HMACOutputLength present.Methods inherited from class org.opensaml.core.testing.XMLObjectBaseTestCase
assertXMLEquals, assertXMLEquals, buildXMLObject, getBuilder, getMarshaller, getMarshaller, getUnmarshaller, getUnmarshaller, getUnmarshaller, initXMLObjectSupport, parseXMLDocument, printXML, printXML, unmarshallElement, unmarshallElementMethods inherited from class org.opensaml.core.testing.OpenSAMLInitBaseTestCase
initOpenSAML
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
goodCredential
Credential used to sign and verify. -
badCredential
Invalid credential for verification. -
sxoBuilder
Builder of mock XML objects. -
sigBuilder
Builder of Signature XML objects. -
keyInfoBuilder
Build of KeyInfo objects. -
hmacOutputLength
Value of HMACOutputLength element child of SignatureMethod. -
expectedKeyName
Expected key name value in KeyInfo. -
algoURI
Signature algorithm URI.
-
-
Constructor Details
-
HMACSignatureTest
public HMACSignatureTest()
-
-
Method Details
-
setUp
- Throws:
Exception
-
testSigningAndVerificationNoOutputLength
public void testSigningAndVerificationNoOutputLength() throws MarshallingException, SignatureExceptionTests creating an enveloped signature and then verifying it.- Throws:
MarshallingException- thrown if the XMLObject tree can not be marshalledSignatureException- ...
-
testSigningAndVerificationWithOutputLength
public void testSigningAndVerificationWithOutputLength() throws MarshallingException, SignatureExceptionTests creating an enveloped signature and then verifying it.- Throws:
MarshallingException- thrown if the XMLObject tree can not be marshalledSignatureException- ...
-
testUnmarshallNoOutputLength
Tests unmarshalling with SignatureMethod/HMACOutputLength not present.- Throws:
XMLParserException- thrown if the XML can not be parsedUnmarshallingException- thrown if the DOM can not be unmarshalled
-
testUnmarshallWithOutputLength
Tests unmarshalling with SignatureMethod/HMACOutputLength present.- Throws:
XMLParserException- thrown if the XML can not be parsedUnmarshallingException- thrown if the DOM can not be unmarshalled
-
testMarshallNoOutputLength
Tests marshalling with SignatureMethod/HMACOutputLength not present.- Throws:
MarshallingException- thrown in signed object can't be marshalled
-
testMarshallWithOutputLength
Tests marshalling with SignatureMethod/HMACOutputLength present.- Throws:
MarshallingException- thrown in signed object can't be marshalled
-
getXMLObjectWithSignature
Creates a XMLObject that has a Signature child element.- Parameters:
useHMACOutputLength- if true, set value for HMACOutputLength- Returns:
- a XMLObject that has a Signature child element
-