java.lang.Object
java.io.InputStream
com.ibm.crypto.zsecurity.provider.RACFInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
This class extends
InputStream and is used by
JceRACFKeyStore to read certificates and
private keys from RACF.-
Constructor Summary
ConstructorsConstructorDescriptionRACFInputStream(String userID, String ringid, char[] passwd) Constructs an instance ofRACFInputStream. -
Method Summary
Modifier and TypeMethodDescriptionintReturn the number of bytes of data that can be read from this input stream.voidclose()Closes this input stream and releases any system resources associated with the stream.getEntry(Hashtable<String, RACFObject> racfs, String key, char[] passwd) Retrieve a RACFHWKeyEntryobject from the givenracfshash table with the specifiedkeyalias.voidmark(int readlimit) Marks the current position in this input stream.booleanTests if this input stream supports themarkandresetmethods.intread()Read the next byte of data from the input stream.intread(byte[] buffer) Read data fromRACFInputStreamand store it into the specified byte array.intread(byte[] buffer, int offset, int count) Read up tocountbytes of data fromRACFInputStreamand store it into the specified byte array.voidreset()Repositions this stream to the position at the time themarkmethod was last called on this input stream.x2c(byte[] data) Convert the given byte array into a hexadecimal string representation.Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skip, skipNBytes, transferTo
-
Constructor Details
-
RACFInputStream
Constructs an instance ofRACFInputStream. ARACFInputStreamis used to access certificates and keys from a RACF key ring.During the construction of this object, all key and certificate entries are read from the specified RACF key ring and stored internally in a byte array, to be consumed later.
- Parameters:
userID- a string containing the ID of the user that owns the keyringringid- a string containing the name of the RACF key ringpasswd- a character array containing the password for the keystore- Throws:
IOException- if there is an error retrieving keys and certificates from the RACF key ring.
-
-
Method Details
-
read
Read data fromRACFInputStreamand store it into the specified byte array.- Overrides:
readin classInputStream- Parameters:
buffer- the buffer into which the data is read- Returns:
- the total number of bytes read into the buffer, or -1 if there is no more data.
- Throws:
IOException- if some I/O error occurs.
-
read
Read up tocountbytes of data fromRACFInputStreamand store it into the specified byte array.- Overrides:
readin classInputStream- Parameters:
buffer- the buffer into which the data is readoffset- the start offset in arraybufferat which the data is writtencount- the maximum number of bytes to read- Returns:
- the total number of bytes read into the buffer, or -1 if the
buffersize is smaller thancountor end of the stream is reached. - Throws:
IOException- if some I/O error occurs.
-
read
Read the next byte of data from the input stream.- Specified by:
readin classInputStream- Returns:
- the next byte of data, or -1 if the end of the stream is reached.
- Throws:
IOException- if an I/O error occurs.
-
available
public int available()Return the number of bytes of data that can be read from this input stream.- Overrides:
availablein classInputStream- Returns:
- the number of bytes that can be read from this input stream.
-
markSupported
public boolean markSupported()Tests if this input stream supports themarkandresetmethods.- Overrides:
markSupportedin classInputStream- Returns:
- always
false.
-
close
Closes this input stream and releases any system resources associated with the stream.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException- if an I/O error occurs.
-
mark
public void mark(int readlimit) Marks the current position in this input stream. This method is not supported and will act as a NOOP.- Overrides:
markin classInputStream- Parameters:
readlimit- the maximum limit of bytes that can be read before the mark position becomes invalid
-
reset
Repositions this stream to the position at the time themarkmethod was last called on this input stream. This method is not supported and will always throw anIOException.- Overrides:
resetin classInputStream- Throws:
IOException- is always thrown.
-
x2c
Convert the given byte array into a hexadecimal string representation. The hexadecimal string representation will contain 16 bytes of formatted HEX per line, followed by the original byte data.- Parameters:
data- the byte array to convert- Returns:
- a hexadecimal string representation of the given byte array.
-
getEntry
public Object getEntry(Hashtable<String, RACFObject> racfs, String key, char[] passwd) throws IOExceptionRetrieve a RACFHWKeyEntryobject from the givenracfshash table with the specifiedkeyalias.- Parameters:
racfs- hash table containing RACF keys and certificateskey- alias of the RACF entry to getpasswd- password protecting the RACF key- Returns:
- the constructed
HWKeyEntryobject. - Throws:
IllegalArgumentException- if racfs is nullIOException- if an I/O error is detected.
-