Class EPPSignedMark
- java.lang.Object
-
- com.verisign.epp.codec.signedMark.EPPSignedMark
-
- All Implemented Interfaces:
EPPCodecComponent,java.io.Serializable,java.lang.Cloneable
- Direct Known Subclasses:
EPPEncodedSignedMark
public class EPPSignedMark extends java.lang.Object implements EPPCodecComponent
Class for the signed mark, which contains the mark (EPPMark), and additional elements associated with the signing of the mark like the serial number of the signed mark, the expiration of the signed mark, and theXMLSignatureitself.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringELM_SIGNED_MARK_LOCALNAMEConstant for the mark local name for signedMark elementstatic java.lang.StringELM_SIGNED_MARK_NAMEConstant for the mark tag for signedMark elementstatic java.lang.StringNSNamespace URI associated with EPPLaunchExtFactory.static java.lang.StringNS_PREFIXNamespace prefix associated with EPPLaunchExtFactory.static java.lang.StringNS_SCHEMAXML Schema definition for EPPLaunchExtFactory
-
Constructor Summary
Constructors Constructor Description EPPSignedMark()Create anEPPSignedMarkinstance.EPPSignedMark(byte[] aSignedMarkArray)Create theEPPSignedMarkobject from the inputbyte[](XML).EPPSignedMark(EPPEncodedSignedMark aEncodedSignedMark)Convert anEPPEncodedSignedMarkinto anEPPSignedMark.EPPSignedMark(java.lang.String aId, EPPIssuer aIssuer, java.util.Date aNotBefore, java.util.Date aNotAfter, EPPMark aMark)Create anEPPSignedMarkwith the id, issuer, not before date, not after date, and the mark attributes of the signed mark.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()CloneEPPSignedMark.protected voiddecode(byte[] aSignedMarkArray)Create a DOM document from byte array.voiddecode(org.w3c.dom.Element aElement)Decode theEPPSignedMarkcomponentbyte[]encode()Encode the signed mark to abyte[].org.w3c.dom.Elementencode(org.w3c.dom.Document aDocument)Sets all this instance's data in the given XML documentbooleanequals(java.lang.Object aObject)implements a deepEPPSignedMarkcompare.java.lang.StringgetAttrIdValue()Gets the "id" attribute value.java.lang.StringgetId()Gets the identifier of the signed mark.EPPIssuergetIssuer()Gets issuer of the signed mark.java.lang.StringgetLocalName()Gets the XML local name for the signed mark.EPPMarkgetMark()Gets the mark associated with the signed mark.java.lang.StringgetNamespace()Returns the XML namespace associated with theEPPCodecComponent.java.util.DategetNotAfter()Gets the date of expiration of the signed mark.java.util.DategetNotBefore()Gets the date of creation of the signed mark.voidsign(java.security.PrivateKey aPrivateKey)Digitally sign the signed mark using the passed private key.voidsign(java.security.PrivateKey aPrivateKey, java.security.cert.Certificate[] aCertChain)Digitally sign the signed mark using the passed private key and a chain of certificates.java.lang.StringtoString()Implementation ofObject.toString, which will result in an indented XMLStringrepresentation of the concreteEPPCodecComponent.booleanvalidate(java.security.cert.PKIXParameters aPKIXParameters)Validate the signature attribute against the signed mark attributes by using the public key of the certificate or the top certificate in the certificate chain contained in theXMLSignaturewith using the passed PKIX parameters to the PKIXCertPathValidatoralgorithm.booleanvalidate(java.security.cert.PKIXParameters aPKIXParameters, boolean aSynchronizePKIXParameters)Validate the signature attribute against the signed mark attributes by using the public key of the certificate or the top certificate in the certificate chain contained in theXMLSignaturewith using the passed PKIX parameters to the PKIXCertPathValidatoralgorithm.booleanvalidate(java.security.PublicKey aPublicKey)Validate the signature attribute against the signed mark attributes.
-
-
-
Field Detail
-
NS
public static final java.lang.String NS
Namespace URI associated with EPPLaunchExtFactory.- See Also:
- Constant Field Values
-
NS_PREFIX
public static final java.lang.String NS_PREFIX
Namespace prefix associated with EPPLaunchExtFactory.- See Also:
- Constant Field Values
-
NS_SCHEMA
public static final java.lang.String NS_SCHEMA
XML Schema definition for EPPLaunchExtFactory- See Also:
- Constant Field Values
-
ELM_SIGNED_MARK_LOCALNAME
public static final java.lang.String ELM_SIGNED_MARK_LOCALNAME
Constant for the mark local name for signedMark element- See Also:
- Constant Field Values
-
ELM_SIGNED_MARK_NAME
public static final java.lang.String ELM_SIGNED_MARK_NAME
Constant for the mark tag for signedMark element- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EPPSignedMark
public EPPSignedMark()
Create anEPPSignedMarkinstance.
-
EPPSignedMark
public EPPSignedMark(EPPEncodedSignedMark aEncodedSignedMark)
Convert anEPPEncodedSignedMarkinto anEPPSignedMark.- Parameters:
aEncodedSignedMark-EPPEncodedSignedMarkto convert from.
-
EPPSignedMark
public EPPSignedMark(java.lang.String aId, EPPIssuer aIssuer, java.util.Date aNotBefore, java.util.Date aNotAfter, EPPMark aMark) throws EPPEncodeException, EPPDecodeExceptionCreate anEPPSignedMarkwith the id, issuer, not before date, not after date, and the mark attributes of the signed mark. The default encoding is XML and the signature must be generated by callingsign(PrivateKey). Once object is created using this constructor, one should not update the Mark object. In case mark object get updated, changes will not be included in XML/signature.- Parameters:
aId- Identifier of signed markaIssuer- Signed mark issuer informationaNotBefore- Date and time that the signed mark was created.aNotAfter- Date and time that the signed mark expires.aMark- Mark information- Throws:
EPPEncodeException- Thrown if any errors prevent encoding.EPPDecodeException- Error decoding the Issuer or Mark object.
-
EPPSignedMark
public EPPSignedMark(byte[] aSignedMarkArray) throws EPPDecodeExceptionCreate theEPPSignedMarkobject from the inputbyte[](XML).- Parameters:
aSignedMarkArray-byte[]to decode the attribute values- Throws:
EPPDecodeException- Error decoding thebyte[].
-
-
Method Detail
-
decode
public void decode(org.w3c.dom.Element aElement) throws EPPDecodeExceptionDecode theEPPSignedMarkcomponent- Specified by:
decodein interfaceEPPCodecComponent- Parameters:
aElement- Root element of theEPPSignedMark- Throws:
EPPDecodeException- Error decoding theEPPSignedMark
-
decode
protected void decode(byte[] aSignedMarkArray) throws EPPDecodeExceptionCreate a DOM document from byte array. Initialized the instance variables like mark, issuer etc. Sets the signedMarkElement.- Parameters:
aSignedMarkArray-byte[]to decode the attribute values- Throws:
EPPDecodeException- Error decoding thebyte[].
-
encode
public byte[] encode() throws EPPEncodeExceptionEncode the signed mark to abyte[].- Returns:
byte[]representing signed mark- Throws:
EPPEncodeException- Error encoding the signed mark
-
encode
public org.w3c.dom.Element encode(org.w3c.dom.Document aDocument) throws EPPEncodeExceptionSets all this instance's data in the given XML document- Specified by:
encodein interfaceEPPCodecComponent- Parameters:
aDocument- a DOM Document to attach data to.- Returns:
- The root element of this component.
- Throws:
EPPEncodeException- Thrown if any errors prevent encoding.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedExceptionCloneEPPSignedMark. Signature element is not cloned.- Specified by:
clonein interfaceEPPCodecComponent- Overrides:
clonein classjava.lang.Object- Returns:
- clone of
EPPSignedMark - Throws:
java.lang.CloneNotSupportedException- standard Object.clone exception
-
sign
public void sign(java.security.PrivateKey aPrivateKey) throws EPPExceptionDigitally sign the signed mark using the passed private key. No certificates will be added using this method. If certificates need to be added usesign(PrivateKey, Certificate[]).- Parameters:
aPrivateKey- Private key used to sign the signed mark- Throws:
EPPException- Error creating the digital signature
-
sign
public void sign(java.security.PrivateKey aPrivateKey, java.security.cert.Certificate[] aCertChain) throws EPPExceptionDigitally sign the signed mark using the passed private key and a chain of certificates.- Parameters:
aPrivateKey- Private key used to sign the signed markaCertChain- Certificate chain to include in the XMLSignature associated with the private key. Passnullto not include the certificate chain in the XMLSignature.- Throws:
EPPException- Error creating the digital signature
-
validate
public boolean validate(java.security.cert.PKIXParameters aPKIXParameters)
Validate the signature attribute against the signed mark attributes by using the public key of the certificate or the top certificate in the certificate chain contained in theXMLSignaturewith using the passed PKIX parameters to the PKIXCertPathValidatoralgorithm. The trust store can be loaded and used to create an instance ofPKIXParametersto verify the certificate chain included in theXMLSignaturewith the trust anchors included in the trust store. This method will automatically synchronize theaPKIXParametersparameter when used, since it is not thread-safe. Usevalidate(PKIXParameters, boolean)to explicitly set theaPKIXParameterssynchronization setting.- Parameters:
aPKIXParameters- Parameters used as input for the PKIXCertPathValidatoralgorithm.- Returns:
trueif valid;falseotherwise.
-
validate
public boolean validate(java.security.cert.PKIXParameters aPKIXParameters, boolean aSynchronizePKIXParameters)Validate the signature attribute against the signed mark attributes by using the public key of the certificate or the top certificate in the certificate chain contained in theXMLSignaturewith using the passed PKIX parameters to the PKIXCertPathValidatoralgorithm. The trust store can be loaded and used to create an instance ofPKIXParametersto verify the certificate chain included in theXMLSignaturewith the trust anchors included in the trust store.- Parameters:
aPKIXParameters- Parameters used as input for the PKIXCertPathValidatoralgorithm.aSynchronizePKIXParameters- Should theaPKIXParametersbe synchronized inside the method? If there is no reason to synchronize, thenfalsecan be passed to increase performance.- Returns:
trueif valid;falseotherwise.
-
validate
public boolean validate(java.security.PublicKey aPublicKey)
Validate the signature attribute against the signed mark attributes.- Parameters:
aPublicKey- Public used to validate the signature- Returns:
trueif valid;falseotherwise.
-
equals
public boolean equals(java.lang.Object aObject)
implements a deepEPPSignedMarkcompare.- Overrides:
equalsin classjava.lang.Object- Parameters:
aObject-EPPSignedMarkinstance to compare with- Returns:
- true if equal false otherwise
-
getLocalName
public java.lang.String getLocalName()
Gets the XML local name for the signed mark.- Returns:
- Either
ELM_SIGNED_MARK_LOCALNAMEorELM_ENCODED_SIGNED_MARK_LOCALNAME
-
getId
public java.lang.String getId()
Gets the identifier of the signed mark.- Returns:
- The identifier for the signed mark if set;
nullotherwise.
-
getIssuer
public EPPIssuer getIssuer()
Gets issuer of the signed mark.- Returns:
- The issuer of the signed mark if defined:
nullotherwise.
-
getNotBefore
public java.util.Date getNotBefore()
Gets the date of creation of the signed mark.- Returns:
- the date of creation of the signed mark if set;
nullotherwise.
-
getNotAfter
public java.util.Date getNotAfter()
Gets the date of expiration of the signed mark.- Returns:
- the date of expiration of the signed mark if set;
nullotherwise.
-
getMark
public EPPMark getMark()
Gets the mark associated with the signed mark.- Returns:
- The mark associated with the signed mark if defined:
nullotherwise.
-
getAttrIdValue
public java.lang.String getAttrIdValue()
Gets the "id" attribute value.- Returns:
- Value of the "id" attribute value.
-
toString
public java.lang.String toString()
Implementation ofObject.toString, which will result in an indented XMLStringrepresentation of the concreteEPPCodecComponent.- Overrides:
toStringin classjava.lang.Object- Returns:
- Indented XML
Stringif successful;ERRORotherwise.
-
getNamespace
public java.lang.String getNamespace()
Returns the XML namespace associated with theEPPCodecComponent.- Specified by:
getNamespacein interfaceEPPCodecComponent- Returns:
- XML namespace for the
EPPCodecComponent.
-
-