public class DigestedDataDemo extends java.lang.Object
DigestedDataStream
and
DigestedData
for digesting data using the CMS type
DigestedData.Constructor and Description |
---|
DigestedDataDemo()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
createDigestedData(byte[] message,
int mode)
Creates a CMS
DigestedData object. |
byte[] |
createDigestedDataStream(byte[] message,
int mode)
Creates a CMS
DigestedData object. |
byte[] |
getDigestedData(byte[] encoding,
byte[] message)
Parses a CMS
DigestedData object and verifies the hash value. |
byte[] |
getDigestedDataStream(byte[] digestedData,
byte[] message)
Parses a CMS
DigestedData object and verifies the hash. |
static void |
main(java.lang.String[] argv)
Main method.
|
void |
start()
Starts the tests.
|
public DigestedDataDemo() throws java.io.IOException
java.io.IOException
public byte[] createDigestedDataStream(byte[] message, int mode) throws iaik.cms.CMSException, java.io.IOException
DigestedData
object.
message
- the message to be digested, as byte representationmode
- IMPLICIT (include message) or EXPLICIT (do not include message)DigestedData
object just creatediaik.cms.CMSException
- if the DigestedData
object cannot
be createdjava.io.IOException
- if an I/O error occurspublic byte[] getDigestedDataStream(byte[] digestedData, byte[] message) throws iaik.cms.CMSException, java.io.IOException
DigestedData
object and verifies the hash.digestedData
- DigestedData
object as DER encoded byte arraymessage
- the the message which was transmitted out-of-bandiaik.cms.CMSException
- if some parsing error occurs or the hash verification failsjava.io.IOException
- if an I/O error occurspublic byte[] createDigestedData(byte[] message, int mode) throws iaik.cms.CMSException, java.io.IOException
DigestedData
object.
message
- the message to be digested, as byte representationmode
- IMPLICIT (include message) or EXPLICIT (do not include message)DigestedData
iaik.cms.CMSException
- if the DigestedData
object cannot
be createdjava.io.IOException
- if an I/O error occurspublic byte[] getDigestedData(byte[] encoding, byte[] message) throws iaik.cms.CMSException, java.io.IOException
DigestedData
object and verifies the hash value.encoding
- the DER encoded DigestedData
objectmessage
- the the message which was transmitted out-of-band (explicit digested)iaik.cms.CMSException
- if some parsing error occurs or the hash verification failsjava.io.IOException
- if an I/O error occurspublic void start()
public static void main(java.lang.String[] argv) throws java.lang.Exception
java.lang.Exception