| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
  |
  +--iaik.pkcs.pkcs7.DataStream
        |
        +--iaik.pkcs.pkcs7.Data
This class represents the non-stream implementation of the PKCS#7 content type
 Data.
 
Each PKCS#7 content type is associated with a specific object identifier, derived from:
 pkcs-7 OBJECT IDENTIFIER ::=
   { iso(1) member-body(2) US(840) rsadsi(113549)
       pkcs(1) 7 }
 
 The object identifier for the Data content type is defined as:
 
 data OBJECT IDENTIFIER ::= { pkcs-7 1 }
 
which corresponds to the OID string "1.2.840.1.113549.1.7.1".
 PKCS#7 specifies
 the Data content type as base type without any cryptographic enhancements:
 
 Data ::= OCTET STRING
 
 Use the Data(byte[] content)
 constructor to create a new Data object for the given raw data bytes:
 
byte[] value = ...; Data data = new Data(value);Some applications - for instance some versions of Netscape Navigator - use the indefinite constructed encoding method for generating an octet string that is composed of a certain number of definite primitive encoded octet strings:
 0x24 0x80
           0x04 <blocksize> <data>
           0x04 <blocksize> <data>
           0x04 <blocksize> <data>
                ...
 0x00 0x00
 
 For being compatible to such applications, this class provides a constructor where a
 particular blocksize may be specified to give an encoding result as described above:
 Data data = new Data(value, blockSize);
 In contrast to the stream-variant of the PKCS#7 Data type (implemented by the
 DataStream), where the raw data is
 supplied from an input stream and therefore can be read only once, it may be obtained
 arbitrarily often from a non-stream Data object by utilizing the
 getData method.
 
 After transforming a Data object to an ASN1Object by means of the
 toASN1Object method, it may be parsed back again by using
 the Data(ASN1Object obj) constructor.
 In general, the getEncoded method returns this
 Data object as definite primitive encoded octet string:
 
0x04 <length> <data>However, if a positive blocksize has been specified when creating this
Data
 object, the encoding will be indefinite constructed.
 
 For handling large amounts of data, the parent DataStream class should be used.
Content, 
ContentInfo, 
OCTET_STRING| Constructor Summary | |
| protected  | Data()Default constructor for dynamic object creation in ContentInfo. | 
|   | Data(ASN1Object obj)Creates a PKCS#7 Data object from an ASN1Object. | 
|   | Data(byte[] content)Creates a PKCS#7 Dataobject from a byte array supplying
 the data value. | 
|   | Data(byte[] content,
     int blockSize)Creates a PKCS#7 Dataobject from a byte array supplying
 the data value and a blockSize specifying the encoding scheme. | 
|   | Data(InputStream is)Creates a new PKCS#7 Data from a DER encoded InputStream. | 
| Method Summary | |
|  void | decode(ASN1Object obj)Reads and decodes the Data from an ASN1Object. | 
|  void | decode(InputStream is)Reads and decodes the Data from an InputStream. | 
|  byte[] | getData()Returns a byte array holding the value of this Dataobject. | 
|  byte[] | getEncoded()Returns the DER encoding of this Dataobject as byte array. | 
|  InputStream | getInputStream()Returns an InputStream from which the contents of this object can be read. | 
|  ASN1Object | toASN1Object()Returns this PKCS#7 Dataas ASN1Object. | 
|  String | toString(boolean detailed)Returns a string giving some - if requested - detailed information about this Dataobject. | 
| Methods inherited from class iaik.pkcs.pkcs7.DataStream | 
| getBlockSize, getContentType, setBlockSize, toString, writeTo | 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Methods inherited from interface iaik.pkcs.pkcs7.ContentStream | 
| getBlockSize, getContentType, setBlockSize | 
| Constructor Detail | 
protected Data()
public Data(byte[] content)
Data object from a byte array supplying
 the data value.
 Use this constructor for supplying the content value, e.g.:
 Data data = new Data("Test data".getBytes());
 
content - the data value in a byte array
public Data(byte[] content,
            int blockSize)
Data object from a byte array supplying
 the data value and a blockSize specifying the encoding scheme.
 If blockSize is not positive this Data object will be
 encoded as definite primitive octet string:
 0x04 <length> <data>If
blockSize is positive this Data object will be encoded
 as indefinite constructed octet string being composed of a certain number
 of definite primitive octet strings of blockSize length:
 
 0x24 0x80
           0x04 <blocksize> <data>
           0x04 <blocksize> <data>
           0x04 <blocksize> <data>
                ...
 0x00 0x00
 content - the data value in a byte arrayblockSize - for defining the encoding scheme - and specifiying the octet
        string component length, if positive
public Data(ASN1Object obj)
     throws PKCSParsingException
Data object, supplied as ASN1Object that may have been
 created by calling toASN1Object.
 
 Use the Data(byte[] content)
 constructor for supplying the content value when creating a
 Data object.
 
obj - the PKCS#7 Data as ASN1ObjectPKCSParsingException - if an parsing error occurs
public Data(InputStream is)
     throws IOException,
            PKCSParsingException
Data object, supplied as DER encoding from an input stream.
 is - the input stream supplying the DER encoded DataIOException - if an I/O error occurs during reading from the InputStreamPKCSParsingException - if an error occurs while parsing the object| Method Detail | 
public void decode(ASN1Object obj)
            throws PKCSParsingException
decode in interface Contentobj - the PKCS#7 Data object as ASN1ObjectPKCSParsingException - if an error occurs while parsing the object
public void decode(InputStream is)
            throws IOException,
                   PKCSParsingException
decode in interface ContentStreamdecode in class DataStreamis - the InputStream holding a DER encoded PKCS#7 Data objectIOException - if an I/O error occurs during reading from the InputStreamPKCSParsingException - if an error occurs while parsing the objectpublic byte[] getData()
Data object.Data object, as byte arraypublic InputStream getInputStream()
 This method only overrides the corresponding getInputStream method
 of the parent DataStream
 class for returning the content of this Data object. There should be
 no real necessity for using this method since the raw data bytes immediately
 can be obtained by the getData method.
 However, in contrast to the equivalent getInputStream method of the
 parent DataStream class, this method may be called arbitrarly often;
 it only returns a ByteArrayInputStream that is initialized with the raw content bytes.
getInputStream in class DataStreamData object
public ASN1Object toASN1Object()
                        throws PKCSException
Data as ASN1Object.
 From the internal value an ASN.1 OCTET STRING object is created.toASN1Object in interface ContentStreamtoASN1Object in class DataStreamData as ASN1Object (OCTET_STRING)PKCSException - if an ASN.1 parsing error occursOCTET_STRING
public byte[] getEncoded()
                  throws PKCSException
Data object as byte array.
 In general, the data is returned as primitive definte encoded octet string:
 0x04 <length> <data>However, if a positive blocksize has been specified when creating this
Data
 object, the encoding will be indefinite constructed:
 
 0x24 0x80
           0x04 <blocksize> <data>
           0x04 <blocksize> <data>
           0x04 <blocksize> <data>
                ...
 0x00 0x00
 PKCSException - if an encoding error occurspublic String toString(boolean detailed)
Data object.toString in interface ContentStreamtoString in class DataStreamdetailed - - whether or not to give detailed information| 
 | This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note). | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
 IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK
  IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK