XML Security, 1.6

com.ibm.xml.crypto.dsig
Class SignatureEngineRSA

java.lang.Object
  extended by com.ibm.xml.crypto.dsig.SignatureEngineRSA
All Implemented Interfaces:
SignatureEngine

public class SignatureEngineRSA
extends java.lang.Object
implements SignatureEngine


Constructor Summary
SignatureEngineRSA(java.lang.String u, java.security.Provider provider)
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SignatureEngineRSA

public SignatureEngineRSA(java.lang.String u,
                          java.security.Provider provider)
                   throws java.security.NoSuchAlgorithmException
Throws:
java.security.NoSuchAlgorithmException
Method Detail

setParameter

public void setParameter(java.security.spec.AlgorithmParameterSpec spec)
                  throws java.security.InvalidAlgorithmParameterException
Description copied from interface: SignatureEngine
Set an instance of AlgorithmParameterSpec extracted from the content of<ds:SignatureMethod>.

Specified by:
setParameter in interface SignatureEngine
Parameters:
spec - algorithm parameter. It may be null
Throws:
java.security.InvalidAlgorithmParameterException
See Also:
EngineFactory.unmarshalParameter(String, org.w3c.dom.Element)

getURI

public java.lang.String getURI()
Description copied from interface: SignatureEngine
Return the algorithm identifier.

Specified by:
getURI in interface SignatureEngine
Returns:
Algorithm identifier URI.

initSign

public void initSign(java.security.Key key)
              throws java.security.InvalidKeyException
Description copied from interface: SignatureEngine
Initialize for signing.

Specified by:
initSign in interface SignatureEngine
Parameters:
key - Signing key. For asymmetric signature algorithms, it would be an instance of PrivateKey.
Throws:
java.security.InvalidKeyException
See Also:
Signature.initSign(java.security.PrivateKey)

initVerify

public void initVerify(java.security.Key key)
                throws java.security.InvalidKeyException
Description copied from interface: SignatureEngine
Initialize for verification.

Specified by:
initVerify in interface SignatureEngine
Parameters:
key - Verification key. For asymmetric signature algorithms, it would be an instance of PublicKey.
Throws:
java.security.InvalidKeyException
See Also:
Signature.initVerify(java.security.PublicKey)

update

public void update(byte[] data)
            throws java.security.SignatureException
Description copied from interface: SignatureEngine
Add signed/verified data. This method must be equivalent to update(data, 0, data.length).

Specified by:
update in interface SignatureEngine
Parameters:
data - data to be signed or verified
Throws:
java.security.SignatureException
See Also:
Signature.update(byte[])

update

public void update(byte[] data,
                   int off,
                   int len)
            throws java.security.SignatureException
Description copied from interface: SignatureEngine
Add signed/verified data using the byte array, starting offset in the array, and the length.

Specified by:
update in interface SignatureEngine
Parameters:
data - data to be signed or verified
off - starting offset in the data
len - the length to be processed
Throws:
java.security.SignatureException
See Also:
Signature.update(byte[], int, int)

sign

public byte[] sign()
            throws java.security.SignatureException
Description copied from interface: SignatureEngine
Finish to sign, and return the signature value.

Specified by:
sign in interface SignatureEngine
Returns:
signature value to be inserted to <ds:SignatureValue>
Throws:
java.security.SignatureException
See Also:
Signature.sign()

verify

public boolean verify(byte[] signature)
               throws java.security.SignatureException
Description copied from interface: SignatureEngine
Finish to verify, and return the validity against the specified signature value.

Specified by:
verify in interface SignatureEngine
Parameters:
signature - binary representation of the content of <ds:SignatureValue>
Returns:
true if the signature is matched.
Throws:
java.security.SignatureException
See Also:
Signature.verify(byte[])

XML Security, 1.6

Portions Copyright 2003, 2012 IBM Corporation.
Portions Copyright 2003, 2012 Oracle and/or its affiliates.