|
XML Security, 1.6 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SignatureEngine
This defines an interface to sign or verify signature values of XML-Signature.
Our XML-Signature processor uses an instance as follows:
EngineFactory.getSignatureEngine()
,
which instanciates an instance of SignatureEngine
setParameter()
initSign()
(or initVerify()
)
update()
repeatedly
sign()
(or verify()
)
EngineFactory.releaseSignatureEngine()
An EngineFactory
implementation may recycle instances of
SignatureEngine
. In that case, the EngineFactory.getSignatureEngine()
does not instanciate SignatureEngine
, but returns existing instance
which is passed by releaseSignatureEngine()
.
EngineFactory.getSignatureEngine(String)
,
EngineFactory.releaseSignatureEngine(SignatureEngine)
,
Signature
,
Mac
Method Summary | |
---|---|
java.lang.String |
getURI()
Return the algorithm identifier. |
void |
initSign(java.security.Key key)
Initialize for signing. |
void |
initVerify(java.security.Key key)
Initialize for verification. |
void |
setParameter(java.security.spec.AlgorithmParameterSpec spec)
Set an instance of AlgorithmParameterSpec extracted from
the content of<ds:SignatureMethod>. |
byte[] |
sign()
Finish to sign, and return the signature value. |
void |
update(byte[] data)
Add signed/verified data. |
void |
update(byte[] data,
int off,
int len)
Add signed/verified data using the byte array, starting offset in the array, and the length. |
boolean |
verify(byte[] signature)
Finish to verify, and return the validity against the specified signature value. |
Method Detail |
---|
void setParameter(java.security.spec.AlgorithmParameterSpec spec) throws java.security.InvalidAlgorithmParameterException
AlgorithmParameterSpec
extracted from
the content of<ds:SignatureMethod>.
spec
- algorithm parameter. It may be null
java.security.InvalidAlgorithmParameterException
EngineFactory.unmarshalParameter(String, org.w3c.dom.Element)
java.lang.String getURI()
void initSign(java.security.Key key) throws java.security.InvalidKeyException
key
- Signing key. For asymmetric signature algorithms,
it would be an instance of PrivateKey
.
java.security.InvalidKeyException
Signature.initSign(java.security.PrivateKey)
void initVerify(java.security.Key key) throws java.security.InvalidKeyException
key
- Verification key. For asymmetric signature algorithms,
it would be an instance of PublicKey
.
java.security.InvalidKeyException
Signature.initVerify(java.security.PublicKey)
void update(byte[] data) throws java.security.SignatureException
update(data, 0, data.length)
.
data
- data to be signed or verified
java.security.SignatureException
Signature.update(byte[])
void update(byte[] data, int off, int len) throws java.security.SignatureException
data
- data to be signed or verifiedoff
- starting offset in the datalen
- the length to be processed
java.security.SignatureException
Signature.update(byte[], int, int)
byte[] sign() throws java.security.SignatureException
java.security.SignatureException
Signature.sign()
boolean verify(byte[] signature) throws java.security.SignatureException
signature
- binary representation of the content of <ds:SignatureValue>
true
if the signature is matched.
java.security.SignatureException
Signature.verify(byte[])
|
XML Security, 1.6 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |