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 theXMLSignature
itself.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ELM_SIGNED_MARK_LOCALNAME
Constant for the mark local name for signedMark elementstatic java.lang.String
ELM_SIGNED_MARK_NAME
Constant for the mark tag for signedMark elementstatic java.lang.String
NS
Namespace URI associated with EPPLaunchExtFactory.static java.lang.String
NS_PREFIX
Namespace prefix associated with EPPLaunchExtFactory.static java.lang.String
NS_SCHEMA
XML Schema definition for EPPLaunchExtFactory
-
Constructor Summary
Constructors Constructor Description EPPSignedMark()
Create anEPPSignedMark
instance.EPPSignedMark(byte[] aSignedMarkArray)
Create theEPPSignedMark
object from the inputbyte[]
(XML).EPPSignedMark(EPPEncodedSignedMark aEncodedSignedMark)
Convert anEPPEncodedSignedMark
into anEPPSignedMark
.EPPSignedMark(java.lang.String aId, EPPIssuer aIssuer, java.util.Date aNotBefore, java.util.Date aNotAfter, EPPMark aMark)
Create anEPPSignedMark
with 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.Object
clone()
CloneEPPSignedMark
.protected void
decode(byte[] aSignedMarkArray)
Create a DOM document from byte array.void
decode(org.w3c.dom.Element aElement)
Decode theEPPSignedMark
componentbyte[]
encode()
Encode the signed mark to abyte[]
.org.w3c.dom.Element
encode(org.w3c.dom.Document aDocument)
Sets all this instance's data in the given XML documentboolean
equals(java.lang.Object aObject)
implements a deepEPPSignedMark
compare.java.lang.String
getAttrIdValue()
Gets the "id" attribute value.java.lang.String
getId()
Gets the identifier of the signed mark.EPPIssuer
getIssuer()
Gets issuer of the signed mark.java.lang.String
getLocalName()
Gets the XML local name for the signed mark.EPPMark
getMark()
Gets the mark associated with the signed mark.java.lang.String
getNamespace()
Returns the XML namespace associated with theEPPCodecComponent
.java.util.Date
getNotAfter()
Gets the date of expiration of the signed mark.java.util.Date
getNotBefore()
Gets the date of creation of the signed mark.void
sign(java.security.PrivateKey aPrivateKey)
Digitally sign the signed mark using the passed private key.void
sign(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.String
toString()
Implementation ofObject.toString
, which will result in an indented XMLString
representation of the concreteEPPCodecComponent
.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 theXMLSignature
with using the passed PKIX parameters to the PKIXCertPathValidator
algorithm.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 theXMLSignature
with using the passed PKIX parameters to the PKIXCertPathValidator
algorithm.boolean
validate(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 anEPPSignedMark
instance.
-
EPPSignedMark
public EPPSignedMark(EPPEncodedSignedMark aEncodedSignedMark)
Convert anEPPEncodedSignedMark
into anEPPSignedMark
.- Parameters:
aEncodedSignedMark
-EPPEncodedSignedMark
to convert from.
-
EPPSignedMark
public EPPSignedMark(java.lang.String aId, EPPIssuer aIssuer, java.util.Date aNotBefore, java.util.Date aNotAfter, EPPMark aMark) throws EPPEncodeException, EPPDecodeException
Create anEPPSignedMark
with 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 EPPDecodeException
Create theEPPSignedMark
object 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 EPPDecodeException
Decode theEPPSignedMark
component- Specified by:
decode
in interfaceEPPCodecComponent
- Parameters:
aElement
- Root element of theEPPSignedMark
- Throws:
EPPDecodeException
- Error decoding theEPPSignedMark
-
decode
protected void decode(byte[] aSignedMarkArray) throws EPPDecodeException
Create 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 EPPEncodeException
Encode 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 EPPEncodeException
Sets all this instance's data in the given XML document- Specified by:
encode
in 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.CloneNotSupportedException
CloneEPPSignedMark
. Signature element is not cloned.- Specified by:
clone
in interfaceEPPCodecComponent
- Overrides:
clone
in classjava.lang.Object
- Returns:
- clone of
EPPSignedMark
- Throws:
java.lang.CloneNotSupportedException
- standard Object.clone exception
-
sign
public void sign(java.security.PrivateKey aPrivateKey) throws EPPException
Digitally 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 EPPException
Digitally 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. Passnull
to 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 theXMLSignature
with using the passed PKIX parameters to the PKIXCertPathValidator
algorithm. The trust store can be loaded and used to create an instance ofPKIXParameters
to verify the certificate chain included in theXMLSignature
with the trust anchors included in the trust store. This method will automatically synchronize theaPKIXParameters
parameter when used, since it is not thread-safe. Usevalidate(PKIXParameters, boolean)
to explicitly set theaPKIXParameters
synchronization setting.- Parameters:
aPKIXParameters
- Parameters used as input for the PKIXCertPathValidator
algorithm.- Returns:
true
if valid;false
otherwise.
-
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 theXMLSignature
with using the passed PKIX parameters to the PKIXCertPathValidator
algorithm. The trust store can be loaded and used to create an instance ofPKIXParameters
to verify the certificate chain included in theXMLSignature
with the trust anchors included in the trust store.- Parameters:
aPKIXParameters
- Parameters used as input for the PKIXCertPathValidator
algorithm.aSynchronizePKIXParameters
- Should theaPKIXParameters
be synchronized inside the method? If there is no reason to synchronize, thenfalse
can be passed to increase performance.- Returns:
true
if valid;false
otherwise.
-
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:
true
if valid;false
otherwise.
-
equals
public boolean equals(java.lang.Object aObject)
implements a deepEPPSignedMark
compare.- Overrides:
equals
in classjava.lang.Object
- Parameters:
aObject
-EPPSignedMark
instance 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_LOCALNAME
orELM_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;
null
otherwise.
-
getIssuer
public EPPIssuer getIssuer()
Gets issuer of the signed mark.- Returns:
- The issuer of the signed mark if defined:
null
otherwise.
-
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;
null
otherwise.
-
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;
null
otherwise.
-
getMark
public EPPMark getMark()
Gets the mark associated with the signed mark.- Returns:
- The mark associated with the signed mark if defined:
null
otherwise.
-
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 XMLString
representation of the concreteEPPCodecComponent
.- Overrides:
toString
in classjava.lang.Object
- Returns:
- Indented XML
String
if successful;ERROR
otherwise.
-
getNamespace
public java.lang.String getNamespace()
Returns the XML namespace associated with theEPPCodecComponent
.- Specified by:
getNamespace
in interfaceEPPCodecComponent
- Returns:
- XML namespace for the
EPPCodecComponent
.
-
-