APIdia Launch Partner
Top Description Inners Constructors Methods
org.jcp.xml.dsig.internal.dom

pack-priv abstract Class AbstractDOMSignatureMethod

extends DOMStructure
implements SignatureMethod
Class Inheritance
All Implemented Interfaces
javax.xml.crypto.dsig.SignatureMethod, javax.xml.crypto.AlgorithmMethod, javax.xml.crypto.XMLStructure
Known Direct Subclasses
org.jcp.xml.dsig.internal.dom.DOMHMACSignatureMethod, org.jcp.xml.dsig.internal.dom.DOMRSAPSSSignatureMethod, org.jcp.xml.dsig.internal.dom.DOMSignatureMethod
Imports
java.security.InvalidAlgorithmParameterException, .InvalidKeyException, .Key, .SignatureException, java.security.spec.AlgorithmParameterSpec, javax.xml.crypto.MarshalException, javax.xml.crypto.dom.DOMCryptoContext, javax.xml.crypto.dsig.SignatureMethod, .SignedInfo, .XMLSignContext, .XMLSignature, .XMLSignatureException, .XMLValidateContext, javax.xml.crypto.dsig.spec.SignatureMethodParameterSpec, org.w3c.dom.Document, .Element, .Node

An abstract class representing a SignatureMethod. Subclasses implement a specific XML DSig signature algorithm.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static enum

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
checkParams(SignatureMethodParameterSpec
the algorithm-specific params (may be null)
params
)

Checks if the specified parameters are valid for this algorithm.

public boolean
equals(Object o)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

pack-priv abstract AbstractDOMSignatureMethod.Type
getAlgorithmType()

Returns the type of signature algorithm.

pack-priv abstract String
getJCAAlgorithm()

Returns the java.security.Signature or javax.crypto.Mac standard algorithm name.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public void
marshal(Node parent, String dsPrefix, DOMCryptoContext context)

Implements abstract org.jcp.xml.dsig.internal.dom.DOMStructure.marshal.

This method invokes the marshalParams method to marshal any algorithm-specific parameters.

pack-priv void
marshalParams(Element
the parent element to append the parameters to
parent
,
String
the algorithm parameters prefix to use
paramsPrefix
)

Marshals the algorithm-specific parameters to an Element and appends it to the specified parent element.

pack-priv boolean
paramsEqual(AlgorithmParameterSpec spec)

Returns true if parameters are equal; false otherwise.

pack-priv abstract byte[]

Returns:

the signature
sign
(Key
the signing key
key
,
SignedInfo
the SignedInfo
si
,
XMLSignContext
the XMLSignContext
context
)

Signs the bytes with the specified key, using the underlying Signature or Mac algorithm.

pack-priv SignatureMethodParameterSpec

Returns:

the algorithm-specific SignatureMethodParameterSpec
unmarshalParams
(Element
the Element holding the input params
paramsElem
)

Unmarshals SignatureMethodParameterSpec from the specified Element.

pack-priv abstract boolean

Returns:

true if the signature verified successfully, false if not
verify
(Key
the verification key
key
,
SignedInfo
the SignedInfo
si
,
byte[]
the signature bytes to be verified
sig
,
XMLValidateContext
the XMLValidateContext
context
)

Verifies the passed-in signature with the specified key, using the underlying Signature or Mac algorithm.

Inherited from org.jcp.xml.dsig.internal.dom.DOMStructure:
equalsContentisFeatureSupported

Constructor Detail

AbstractDOMSignatureMethodback to summary
pack-priv AbstractDOMSignatureMethod()

Method Detail

checkParamsback to summary
pack-priv void checkParams(SignatureMethodParameterSpec params) throws InvalidAlgorithmParameterException

Checks if the specified parameters are valid for this algorithm. By default, this method throws an exception if parameters are specified since most SignatureMethod algorithms do not have parameters. Subclasses should override it if they have parameters.

Parameters
params:SignatureMethodParameterSpec

the algorithm-specific params (may be null)

Exceptions
InvalidAlgorithmParameterException:
if the parameters are not appropriate for this signature method
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Annotations
@Override
getAlgorithmTypeback to summary
pack-priv abstract AbstractDOMSignatureMethod.Type getAlgorithmType()

Returns the type of signature algorithm.

getJCAAlgorithmback to summary
pack-priv abstract String getJCAAlgorithm()

Returns the java.security.Signature or javax.crypto.Mac standard algorithm name.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
marshalback to summary
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context) throws MarshalException

Implements abstract org.jcp.xml.dsig.internal.dom.DOMStructure.marshal.

This method invokes the marshalParams method to marshal any algorithm-specific parameters.

Annotations
@Override
marshalParamsback to summary
pack-priv void marshalParams(Element parent, String paramsPrefix) throws MarshalException

Marshals the algorithm-specific parameters to an Element and appends it to the specified parent element. By default, this method throws an exception since most SignatureMethod algorithms do not have parameters. Subclasses should override it if they have parameters.

Parameters
parent:Element

the parent element to append the parameters to

paramsPrefix:String

the algorithm parameters prefix to use

Exceptions
MarshalException:
if the parameters cannot be marshalled
paramsEqualback to summary
pack-priv boolean paramsEqual(AlgorithmParameterSpec spec)

Returns true if parameters are equal; false otherwise. Subclasses should override this method to compare algorithm-specific parameters.

signback to summary
pack-priv abstract byte[] sign(Key key, SignedInfo si, XMLSignContext context) throws InvalidKeyException, XMLSignatureException

Signs the bytes with the specified key, using the underlying Signature or Mac algorithm.

Parameters
key:Key

the signing key

si:SignedInfo

the SignedInfo

context:XMLSignContext

the XMLSignContext

Returns:byte[]

the signature

Exceptions
InvalidKeyException:
if the key is improperly encoded, of the wrong type, or parameters are missing, etc
XMLSignatureException:
if an unexpected error occurs
NullPointerException:
if key or si are null
unmarshalParamsback to summary
pack-priv SignatureMethodParameterSpec unmarshalParams(Element paramsElem) throws MarshalException

Unmarshals SignatureMethodParameterSpec from the specified Element. By default, this method throws an exception since most SignatureMethod algorithms do not have parameters. Subclasses should override it if they have parameters.

Parameters
paramsElem:Element

the Element holding the input params

Returns:SignatureMethodParameterSpec

the algorithm-specific SignatureMethodParameterSpec

Exceptions
MarshalException:
if the parameters cannot be unmarshalled
verifyback to summary
pack-priv abstract boolean verify(Key key, SignedInfo si, byte[] sig, XMLValidateContext context) throws InvalidKeyException, SignatureException, XMLSignatureException

Verifies the passed-in signature with the specified key, using the underlying Signature or Mac algorithm.

Parameters
key:Key

the verification key

si:SignedInfo

the SignedInfo

sig:byte[]

the signature bytes to be verified

context:XMLValidateContext

the XMLValidateContext

Returns:boolean

true if the signature verified successfully, false if not

Exceptions
InvalidKeyException:
if the key is improperly encoded, of the wrong type, or parameters are missing, etc
SignatureException:
if an unexpected error occurs, such as the passed in signature is improperly encoded
XMLSignatureException:
if an unexpected error occurs
NullPointerException:
if key, si or sig are null
org.jcp.xml.dsig.internal.dom back to summary

pack-priv final Enum AbstractDOMSignatureMethod.Type

extends Enum<AbstractDOMSignatureMethod.Type>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final AbstractDOMSignatureMethod.Type
public static final AbstractDOMSignatureMethod.Type
public static final AbstractDOMSignatureMethod.Type
public static final AbstractDOMSignatureMethod.Type
public static final AbstractDOMSignatureMethod.Type

Constructor Summary

AccessConstructor and Description
private
Type()

Method Summary

Modifier and TypeMethod and Description
public static AbstractDOMSignatureMethod.Type
public static AbstractDOMSignatureMethod.Type[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

DSAback to summary
public static final AbstractDOMSignatureMethod.Type DSA
ECDSAback to summary
public static final AbstractDOMSignatureMethod.Type ECDSA
EDDSAback to summary
public static final AbstractDOMSignatureMethod.Type EDDSA
HMACback to summary
public static final AbstractDOMSignatureMethod.Type HMAC
RSAback to summary
public static final AbstractDOMSignatureMethod.Type RSA

Constructor Detail

Typeback to summary
private Type()

Method Detail

valueOfback to summary
public static AbstractDOMSignatureMethod.Type valueOf(String name)
valuesback to summary
public static AbstractDOMSignatureMethod.Type[] values()