public class CMSAuthenticatedDataInputStream extends CMSInputStream
CMSAuthenticatedDataInputStream
is used to read authenticated-data
CMS objects.
A CMSAuthenticatedDataInputStream
is essentially a input stream filter that unwraps the CMS authenticated-data
structure from the data read in.
You will be able to read a detached authenticated-data object using the CMSAuthenticatedDataInputStream
class but you will not be able to verify the MAC.
IMPORTANT: This class processes large CMS authenticated-data Objects more efficiently (Java VM memory usage) than the CMSAuthenticatedDataContentInfo
class.
Constructor and Description |
---|
CMSAuthenticatedDataInputStream(CMSInputConnector conn, java.security.PrivateKey recipientPrivateKey, java.security.cert.X509Certificate recipientCert)
Creates a
CMSAuthenticatedDataInputStream . |
CMSAuthenticatedDataInputStream(CMSInputConnector conn, javax.crypto.SecretKey keyEncryptionKey)
Creates a
CMSAuthenticatedDataInputStream . |
CMSAuthenticatedDataInputStream(java.io.InputStream in, java.security.PrivateKey recipientPrivateKey, java.security.cert.X509Certificate recipientCert)
Creates a
CMSAuthenticatedDataInputStream . |
CMSAuthenticatedDataInputStream(java.io.InputStream in, javax.crypto.SecretKey keyEncryptionKey)
Creates a
CMSAuthenticatedDataInputStream . |
Modifier and Type | Method and Description |
---|---|
int |
available() |
AttributeSet |
getAuthenticatedAttributes()
Returns the set of Authenticated Attributes.
|
oracle.security.crypto.core.AlgorithmIdentifier |
getDigestAlgID()
Returns the Digest Algorithm.
|
oracle.security.crypto.asn1.ASN1ObjectID |
getEnclosedContentType()
Returns the content type of the authenticated data.
|
byte[] |
getMAC()
Returns the MAC.
|
oracle.security.crypto.core.AlgorithmIdentifier |
getMACAlgID()
Returns the MAC Algorithm.
|
OriginatorInfo |
getOriginatorInfo()
Returns the Originator Info.
|
AttributeSet |
getUnauthenticatedAttributes()
Returns the set of Unauthenticated Attributes.
|
oracle.security.crypto.asn1.ASN1Integer |
getVersion()
Deprecated.
As of Phaos CMS 2.0.1, replaced by
getVersionNumber() |
java.math.BigInteger |
getVersionNumber()
Returns the version number.
|
void |
mark(int readlimit)
Not supported.
|
boolean |
markSupported()
Always returns
false</false>. |
int |
read() |
int |
read(byte[] buffer, int offset, int len) |
void |
reset()
Not supported.
|
long |
skip(long n)
Not supported.
|
void |
terminate()
Finish reading the
authenticated-data structure. |
void |
verifyMAC()
Verify the Message Authentication Code.
|
public CMSAuthenticatedDataInputStream(java.io.InputStream in, java.security.PrivateKey recipientPrivateKey, java.security.cert.X509Certificate recipientCert) throws java.security.cert.CertificateEncodingException, java.io.IOException, java.security.NoSuchAlgorithmException
CMSAuthenticatedDataInputStream
.
Note the changes in the Method signature
Previouslypublic CMSAuthenticatedDataInputStream (InputStream, oracle.security.crypto.core.PrivateKey ,X509 )
Nowpublic CMSAuthenticatedDataInputStream (InputStream , java.security.PrivateKey, X509Certificate )
Note the changes in exceptions Exceptions included -- CertificateEncodingException,IOException,NoSuchAlgorithmException
in
- The underlying input stream.recipientPrivateKey
- The recipient's private key.recipientCert
- The recipient's certificate.java.security.cert.CertificateEncodingException
- Error while encoding the certificatejava.security.NoSuchAlgorithmException
- Algorithm not supportedjava.io.IOException
- I/O exception while encoding the certificatepublic CMSAuthenticatedDataInputStream(CMSInputConnector conn, java.security.PrivateKey recipientPrivateKey, java.security.cert.X509Certificate recipientCert) throws java.security.cert.CertificateEncodingException, java.security.NoSuchAlgorithmException, java.io.IOException
CMSAuthenticatedDataInputStream
.
Note the changes in the Method signature
Previouslypublic CMSAuthenticatedDataInputStream (CMSInputConnector ,oracle.security.crypto.core.PrivateKey , X509)
Nowpublic CMSAuthenticatedDataInputStream (CMSInputConnector , java.security.PrivateKey , X509Certificate )
Note the changes in exceptions Exceptions included -- CertificateEncodingException,IOException,NoSuchAlgorithmException
conn
- The underlying input connector.recipientPrivateKey
- The recipient's private key.recipientCert
- The recipient's certificate.java.security.cert.CertificateEncodingException
- Error while encoding the certificatejava.security.NoSuchAlgorithmException
- Algorithm not supportedjava.io.IOException
- I/O exception while encoding the certificatepublic CMSAuthenticatedDataInputStream(java.io.InputStream in, javax.crypto.SecretKey keyEncryptionKey)
CMSAuthenticatedDataInputStream
.
Note the changes in the Method signature
Previouslypublic CMSAuthenticatedDataInputStream (InputStream , SymmetricKey )
Nowpublic CMSAuthenticatedDataInputStream (InputStream , SecretKey )
in
- The underlying input stream.keyEncryptionKey
- The key used to encrypt the HMAC key.public CMSAuthenticatedDataInputStream(CMSInputConnector conn, javax.crypto.SecretKey keyEncryptionKey)
CMSAuthenticatedDataInputStream
.
Note the changes in the Method signature
Previouslypublic CMSAuthenticatedDataInputStream (CMSInputConnector , SymmetricKey )
Nowpublic CMSAuthenticatedDataInputStream (CMSInputConnector , SecretKey )
conn
- The underlying input connector.keyEncryptionKey
- The key used to encrypt the HMAC key.public oracle.security.crypto.asn1.ASN1ObjectID getEnclosedContentType() throws java.io.IOException
getEnclosedContentType
in class CMSInputStream
java.io.IOException
- The input encoding is incorrect or an I/O error ocuurred.public void verifyMAC() throws oracle.security.crypto.core.AuthenticationException
oracle.security.crypto.core.AuthenticationException
- MAC verification failed.public int read() throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
public int read(byte[] buffer, int offset, int len) throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
public int available() throws java.io.IOException
available
in class java.io.FilterInputStream
java.io.IOException
public long skip(long n) throws java.io.IOException
IOException
.skip
in class java.io.FilterInputStream
java.io.IOException
public boolean markSupported()
false</false>.
Overrides:
markSupported
in class java.io.FilterInputStream
public void mark(int readlimit)
mark
in class java.io.FilterInputStream
public void reset() throws java.io.IOException
reset
in class java.io.FilterInputStream
java.io.IOException
- alwayspublic void terminate() throws java.io.IOException
authenticated-data
structure.
This method must be called only after all the authenticated data has been read.
terminate
in class CMSInputStream
java.io.IOException
- An I/O error occurred or unread authenticated data is present.public OriginatorInfo getOriginatorInfo() throws java.io.IOException
null
otherwise.java.io.IOException
- An I/O error occurred or the input encoding is incorrect.public AttributeSet getAuthenticatedAttributes() throws java.io.IOException
null
otherwise.java.io.IOException
- An I/O error occurred or the input encoding is incorrect.public AttributeSet getUnauthenticatedAttributes() throws java.io.IOException
null
otherwise.java.io.IOException
- An I/O error occurred or the input encoding is incorrect.public java.math.BigInteger getVersionNumber() throws java.io.IOException
java.io.IOException
public oracle.security.crypto.asn1.ASN1Integer getVersion() throws java.io.IOException
getVersionNumber()
java.io.IOException
- An I/O error occurred or the input encoding is incorrect.public oracle.security.crypto.core.AlgorithmIdentifier getMACAlgID() throws java.io.IOException
java.io.IOException
- An I/O error occurred or the input encoding is incorrect.public oracle.security.crypto.core.AlgorithmIdentifier getDigestAlgID() throws java.io.IOException
null
otherwise.java.io.IOException
- An I/O error occurred or the input encoding is incorrect.public byte[] getMAC() throws java.io.IOException
java.io.IOException
- An I/O error occurred or the input encoding is incorrect.