|
Message Security Layer (MSL) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
com.netflix.msl.msg.MessageInputStream
public class MessageInputStream
A MSL message consists of a single MSL header followed by one or more payload chunks carrying application data. Each payload chunk is individually packaged but sequentially ordered. No payload chunks may be included in an error message.
Data is read until an end-of-message payload chunk is encountered or an
error occurs. Closing a MessageInputStream
does not close the source
input stream in case additional MSL messages will be read.
Constructor Summary | |
---|---|
MessageInputStream(MslContext ctx,
InputStream source,
Charset charset,
Set<KeyRequestData> keyRequestData,
Map<String,ICryptoContext> cryptoContexts)
Construct a new message input stream. |
Method Summary | |
---|---|
int |
available()
|
void |
close()
|
void |
closeSource(boolean close)
By default the source input stream is not closed when this message input stream is closed. |
protected void |
finalize()
|
ErrorHeader |
getErrorHeader()
|
String |
getIdentity()
Returns the sender's entity identity. |
ICryptoContext |
getKeyExchangeCryptoContext()
|
MessageHeader |
getMessageHeader()
|
ICryptoContext |
getPayloadCryptoContext()
|
com.netflix.msl.tokens.MslUser |
getUser()
Returns the user associated with the message. |
boolean |
isHandshake()
Returns true if the message is a handshake message. |
void |
mark(int readlimit)
|
boolean |
markSupported()
|
int |
read()
|
int |
read(byte[] cbuf)
|
int |
read(byte[] cbuf,
int off,
int len)
|
void |
reset()
|
long |
skip(long n)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MessageInputStream(MslContext ctx, InputStream source, Charset charset, Set<KeyRequestData> keyRequestData, Map<String,ICryptoContext> cryptoContexts) throws MslEncodingException, MslEntityAuthException, MslCryptoException, MslUserAuthException, MslMessageException, MslKeyExchangeException, MslMasterTokenException, MslUserIdTokenException, MslMessageException, MslException
Construct a new message input stream. The header is parsed.
If key request data is provided and a matching key response data is found in the message header the key exchange will be performed to process the message payloads.
Service tokens will be decrypted and verified with the provided crypto contexts identified by token name. A default crypto context may be provided by using the empty string as the token name; if a token name is not explcitly mapped onto a crypto context, the default crypto context will be used.
ctx
- MSL context.source
- MSL input stream.charset
- input stream character set encoding.keyRequestData
- key request data to use when processing key
response data.cryptoContexts
- the map of service token names onto crypto
contexts used to decrypt and verify service tokens.
MslEncodingException
- if there is an error parsing the message.
MslCryptoException
- if there is an error decrypting or verifying
the header or creating the message payload crypto context.
MslEntityAuthException
- if unable to create the entity
authentication data.
MslUserAuthException
- if unable to create the user authentication
data.
MslMessageException
- if the message master token is expired and
the message is not renewable.
MslMasterTokenException
- if the master token is not trusted and
needs to be or if it has been revoked.
MslUserIdTokenException
- if the user ID token has been revoked.
MslKeyExchangeException
- if there is an error with the key
request data or key response data or the key exchange scheme is
not supported.
MslMessageException
- if the message master token is expired and
the message is not renewable.
MslException
- if the message does not contain an entity
authentication data or a master token, or a token is improperly
bound to another token.Method Detail |
---|
protected void finalize() throws Throwable
finalize
in class Object
Throwable
public boolean isHandshake() throws MslCryptoException, MslEncodingException, MslMessageException, MslInternalException, MslException
MslCryptoException
- if there is a problem decrypting or verifying
the payload chunk.
MslEncodingException
- if there is a problem parsing the JSON.
MslMessageException
- if the payload verification failed.
MslInternalException
- if attempting to access payloads of an
error message.
MslException
- if there is an error uncompressing the data.public MessageHeader getMessageHeader()
public ErrorHeader getErrorHeader()
public String getIdentity() throws MslCryptoException
MslCryptoException
- if there is a crypto error accessing the
entity identity;public com.netflix.msl.tokens.MslUser getUser()
public ICryptoContext getPayloadCryptoContext()
public ICryptoContext getKeyExchangeCryptoContext()
public int available() throws IOException
available
in class InputStream
IOException
public void closeSource(boolean close)
close
- true if the source input stream should be closed, false if
it should not.public void close() throws IOException
close
in interface Closeable
close
in class InputStream
IOException
public void mark(int readlimit)
mark
in class InputStream
public boolean markSupported()
markSupported
in class InputStream
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] cbuf, int off, int len) throws IOException
read
in class InputStream
IOException
public int read(byte[] cbuf) throws IOException
read
in class InputStream
IOException
public void reset() throws IOException
reset
in class InputStream
IOException
public long skip(long n) throws IOException
skip
in class InputStream
IOException
|
Message Security Layer (MSL) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |