Class EPPSignedCode
java.lang.Object
com.verisign.epp.codec.verificationcode.EPPSignedCode
- All Implemented Interfaces:
EPPCodecComponent,Serializable,Cloneable
- Direct Known Subclasses:
EPPEncodedSignedCodeValue
Class for the signed code, which contains the verification code and the
XMLSignature.- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate anEPPSignedCodeinstance.EPPSignedCode(byte[] aSignedCodeArray) Create theEPPSignedCodeobject from the inputbyte[](XML).EPPSignedCode(EPPEncodedSignedCodeValue aEncodedSignedCode) Convert anEPPEncodedSignedCodeinto anEPPSignedCode.EPPSignedCode(EPPVerificationCode aCode) Create anEPPSignedCodewith the code of the signed code.EPPSignedCode(String aCode, String aType) Create anEPPSignedCodewith the type and code of the signed code. -
Method Summary
Modifier and TypeMethodDescriptionclone()CloneEPPSignedCode.voiddecode(byte[] aSignedCodeArray) Create a DOM document from byte array.voidDecode theEPPSignedCodecomponentbyte[]encode()Encode the signed code to abyte[].Sets all this instance's data in the given XML documentbooleanimplements a deepEPPSignedCodecompare.Gets the "id" attribute value.getCode()Gets the code value associated with the signed code.Gets the code type of the contained code.Gets the code value of the contained code.Gets the XML local name for the signed code.Returns the XML namespace associated with theEPPCodecComponent.Gets the Trust Anchor associated with the validated signed code.booleanHas the Trust Anchor been set?voidsign(PrivateKey aPrivateKey) Digitally sign the signed code using the passed private key.voidsign(PrivateKey aPrivateKey, Certificate[] aCertChain) Digitally sign the signed code using the passed private key and a chain of certificates.toString()Implementation ofObject.toString, which will result in an indented XMLStringrepresentation of the concreteEPPCodecComponent.booleanvalidate(PKIXParameters aPKIXParameters) Validate the signature attribute against the signed code 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(PKIXParameters aPKIXParameters, boolean aSynchronizePKIXParameters) Validate the signature attribute against the signed code 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 the signature attribute against the signed code attributes.
-
Field Details
-
ELM_SIGNED_CODE_LOCALNAME
Constant for the code local name for signedCode element- See Also:
-
ELM_SIGNED_CODE
Constant for the code tag for signedCode element- See Also:
-
-
Constructor Details
-
EPPSignedCode
public EPPSignedCode()Create anEPPSignedCodeinstance. -
EPPSignedCode
Convert anEPPEncodedSignedCodeinto anEPPSignedCode.- Parameters:
aEncodedSignedCode-EPPEncodedSignedCodeto convert from.
-
EPPSignedCode
Create anEPPSignedCodewith the code of the signed code. The default encoding is XML and the signature must be generated by callingsign(PrivateKey). Once the object is created using this constructor, one should not update the object. In the case the object gets updated, changes will not be included in XML/signature.- Parameters:
aCode- Verification code- Throws:
EPPEncodeException- Thrown if any errors prevent encoding.
-
EPPSignedCode
Create anEPPSignedCodewith the type and code of the signed code. The default encoding is XML and the signature must be generated by callingsign(PrivateKey). Once the object is created using this constructor, one should not update the object. In the case the object gets updated, changes will not be included in XML/signature.- Parameters:
aCode- Verification codeaType- Type of the verification code- Throws:
EPPEncodeException- Thrown if any errors prevent encoding.
-
EPPSignedCode
Create theEPPSignedCodeobject from the inputbyte[](XML).- Parameters:
aSignedCodeArray-byte[]to decode the attribute values- Throws:
EPPDecodeException- Error decoding thebyte[].
-
-
Method Details
-
decode
Decode theEPPSignedCodecomponent- Specified by:
decodein interfaceEPPCodecComponent- Parameters:
aElement- Root element of theEPPSignedCode- Throws:
EPPDecodeException- Error decoding theEPPSignedCode
-
decode
Create a DOM document from byte array. Initialized the instance variables like code, issuer etc. Sets the signedCodeElement.- Parameters:
aSignedCodeArray-byte[]to decode the attribute values- Throws:
EPPDecodeException- Error decoding thebyte[].
-
encode
Encode the signed code to abyte[].- Returns:
byte[]representing signed code- Throws:
EPPEncodeException- Error encoding the signed code
-
encode
Sets 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
CloneEPPSignedCode. Signature element is not cloned.- Specified by:
clonein interfaceEPPCodecComponent- Overrides:
clonein classObject- Returns:
- clone of
EPPSignedCode - Throws:
CloneNotSupportedException- standard Object.clone exception
-
sign
Digitally sign the signed code 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 code- Throws:
EPPException- Error creating the digital signature
-
sign
Digitally sign the signed code using the passed private key and a chain of certificates.- Parameters:
aPrivateKey- Private key used to sign the signed codeaCertChain- 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
Validate the signature attribute against the signed code 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
Validate the signature attribute against the signed code 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
Validate the signature attribute against the signed code attributes.- Parameters:
aPublicKey- Public used to validate the signature- Returns:
trueif valid;falseotherwise.
-
equals
implements a deepEPPSignedCodecompare. -
getLocalName
Gets the XML local name for the signed code.- Returns:
- Either
ELM_SIGNED_MARK_LOCALNAMEorELM_ENCODED_SIGNED_MARK_LOCALNAME
-
getCode
Gets the code value associated with the signed code.- Returns:
- The code associated with the signed code if defined:
nullotherwise.
-
getCodeValue
Gets the code value of the contained code.- Returns:
- Verification code value
-
getCodeType
Gets the code type of the contained code.- Returns:
- Verification code type
-
getAttrIdValue
Gets the "id" attribute value.- Returns:
- Value of the "id" attribute value.
-
hasTrustAnchor
public boolean hasTrustAnchor()Has the Trust Anchor been set?- Returns:
trueif the Trust Anchor has been set;falseotherwise.
-
getTrustAnchor
Gets the Trust Anchor associated with the validated signed code.- Returns:
- Trust Anchor if defined;
nullotherwise.
-
toString
Implementation ofObject.toString, which will result in an indented XMLStringrepresentation of the concreteEPPCodecComponent. -
getNamespace
Returns the XML namespace associated with theEPPCodecComponent.- Specified by:
getNamespacein interfaceEPPCodecComponent- Returns:
- XML namespace for the
EPPCodecComponent.
-