Class EPPAuthTokenData
java.lang.Object
com.verisign.epp.codec.authtoken.v01.EPPAuthTokenData
- All Implemented Interfaces:
EPPCodecComponent,Serializable,Cloneable
The
EPPAuthTokenData is the EPPCodecComponent that knows how
to encode and decode keyData elements from/to XML and object instance.- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance ofEPPAuthTokenDataEPPAuthTokenData(EPPAuthTokenHeader header, EPPAuthTokenPayload payload) Create a new instance ofEPPAuthTokenDatawith the required header and payload data.EPPAuthTokenData(EPPAuthTokenHeader header, EPPAuthTokenPayload payload, String signature) Create a new instance ofEPPAuthTokenDatawith the required header, payload and signature data.EPPAuthTokenData(String aAuthToken) Creates a new instance ofEPPAuthTokenDataobject from the required auth token string. -
Method Summary
Modifier and TypeMethodDescriptionclone()CloneEPPAuthTokenData.voidPopulate the data of this instance with the data stored in the given Element of the DOM treeAppend all data from this authToken:authToken to the given DOM Documentbooleanimplements a deepEPPAuthTokenDatacompare.ReturnEPPAuthTokenHeaderinstanceReturns the XML namespace associated with theEPPCodecComponent.ReturnEPPAuthTokenPayloadinstanceReturn signature valuegetValue()Get the signed and encoded auth token value.loadPrivateKey(String aKeyStoreName, String aKeyAliasName, String aPassword) Loads the private key used to digitally sign from a Java KeyStore with theaKeyAliasNamealias and theaPasswordpassword to access the Keystore and the key.voidsetHeader(EPPAuthTokenHeader header) SetEPPAuthTokenHeaderinstancevoidsetPayload(EPPAuthTokenPayload payload) SetEPPAuthTokenPayloadinstancevoidsetSignature(String signature) Set signature valuevoidSet the signed and encoded auth token value.sign()Digitally sign the auth token with the private key.Digitally sign the auth token with the private key from the given keyAlias.Digitally sign the auth token with the private key from the given keystore, keyAlias and password.sign(PrivateKey aPrivateKey) 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()Validate the signature attribute using the first valid public key.booleanvalidate(io.jsonwebtoken.JwtParser aParser) Validate the signature attribute.booleanValidate the signature attribute.booleanValidate the signature attribute.
-
Field Details
-
ELM_LOCALNAME
- See Also:
-
ELM_NAME
XML Element Name ofEPPAuthTokenDataroot element.- See Also:
-
-
Constructor Details
-
EPPAuthTokenData
public EPPAuthTokenData()Create a new instance ofEPPAuthTokenData -
EPPAuthTokenData
Creates a new instance ofEPPAuthTokenDataobject from the required auth token string. It decodes the given JWSStringinto headerEPPAuthTokenHeaderpayloadEPPAuthTokenPayloadand signatureStringcomponents.
ThrowsEPPDecodeExceptionif the string is an invalid JWS- Throws:
EPPDecodeException
-
EPPAuthTokenData
Create a new instance ofEPPAuthTokenDatawith the required header and payload data. It is required that the caller sets the required signature by invokingsign()method on this instance.- Parameters:
header-payload-
-
EPPAuthTokenData
Create a new instance ofEPPAuthTokenDatawith the required header, payload and signature data.- Parameters:
header-payload-signature-
-
-
Method Details
-
encode
Append all data from this authToken:authToken to the given DOM Document- Specified by:
encodein interfaceEPPCodecComponent- Parameters:
aDocument- The DOM Document to append data to- Returns:
- Encoded DOM
Element - Throws:
EPPEncodeException- Thrown when errors occur during the encode attempt or if the instance is invalid.
-
decode
Populate the data of this instance with the data stored in the given Element of the DOM tree- Specified by:
decodein interfaceEPPCodecComponent- Parameters:
aElement- The root element of the fragment of XML- Throws:
EPPDecodeException- Thrown if any errors occur during decoding.
-
equals
implements a deepEPPAuthTokenDatacompare. -
clone
CloneEPPAuthTokenData.- Specified by:
clonein interfaceEPPCodecComponent- Overrides:
clonein classObject- Returns:
- clone of
EPPAuthTokenData - Throws:
CloneNotSupportedException- standard Object.clone exception
-
getValue
Get the signed and encoded auth token value.- Returns:
- auth token
-
setValue
Set the signed and encoded auth token value.- Parameters:
aCompactToken- auth token.
-
getHeader
ReturnEPPAuthTokenHeaderinstance- Returns:
-
setHeader
SetEPPAuthTokenHeaderinstance- Parameters:
header-
-
getPayload
ReturnEPPAuthTokenPayloadinstance- Returns:
-
setPayload
SetEPPAuthTokenPayloadinstance- Parameters:
payload-
-
getSignature
Return signature value- Returns:
-
setSignature
Set signature value- Parameters:
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 code- Throws:
EPPException- Error creating the digital signature
-
sign
Digitally sign the auth token with the private key from the given keystore, keyAlias and password.- Parameters:
aKeyStoreName-aKeyAliasName-aPassword-- Returns:
- Throws:
Exception
-
sign
Digitally sign the auth token with the private key from the given keyAlias.- Parameters:
aKeyAliasName-- Returns:
- signature value as String
- Throws:
EPPException
-
sign
Digitally sign the auth token with the private key. It derives the private key from the kid in the header.- Returns:
- signature value as String
- Throws:
EPPException
-
validate
Validate the signature attribute using the first valid public key.- Returns:
- true if the signature is valid otherwise false.
- Throws:
EPPException
-
validate
public boolean validate(io.jsonwebtoken.JwtParser aParser) Validate the signature attribute.- Parameters:
aParser- pre initialized parser to validate the signature- Returns:
trueif valid;falseotherwise.
-
validate
Validate the signature attribute. Since the parser is initialized here, this is expensive.- Parameters:
aPublicKey- Public used to validate the signature- Returns:
trueif valid;falseotherwise.- Throws:
Exception
-
validate
public boolean validate(String aKeyStoreName, String aPublicKeyAlias, String aPassword) throws Exception Validate the signature attribute.- Parameters:
aKeyStoreName- JKS file nameaPublicKeyAlias- key alias of the key in JKSaPassword- password for JKS- Returns:
trueif valid;falseotherwise.- Throws:
Exception- Error while loading the key or validating the signature
-
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.
-
loadPrivateKey
public PrivateKey loadPrivateKey(String aKeyStoreName, String aKeyAliasName, String aPassword) throws Exception Loads the private key used to digitally sign from a Java KeyStore with theaKeyAliasNamealias and theaPasswordpassword to access the Keystore and the key.- Parameters:
aKeyStoreName- Java Keystore to load the key fromaKeyAliasName- Java Keystore alias of keyaPassword- Password to access Java Keystore and key- Returns:
- Loaded
KeyStore.PrivateKeyEntrythat can be used to get the private key and it's associated certificate chain. - Throws:
Exception- Error loading private key
-