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
com.ibm.crypto.provider.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 TypeMethodDescriptionint
Return the number of bytes of data that can be read from this input stream.void
close()
Closes this input stream and releases any system resources associated with the stream.getEntry
(Hashtable<String, RACFObject> racfs, String key, char[] passwd) Retrieve a RACFcom.ibm.crypto.provider.HWKeyEntry
object from the givenracfs
hash table with the specifiedkey
alias.void
mark
(int readlimit) Marks the current position in this input stream.boolean
Tests if this input stream supports themark
andreset
methods.int
read()
Read the next byte of data from the input stream.int
read
(byte[] buffer) Read data fromRACFInputStream
and store it into the specified byte array.int
read
(byte[] buffer, int offset, int count) Read up tocount
bytes of data fromRACFInputStream
and store it into the specified byte array.void
reset()
Repositions this stream to the position at the time themark
method 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
. ARACFInputStream
is 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 fromRACFInputStream
and store it into the specified byte array.- Overrides:
read
in 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 tocount
bytes of data fromRACFInputStream
and store it into the specified byte array.- Overrides:
read
in classInputStream
- Parameters:
buffer
- the buffer into which the data is readoffset
- the start offset in arraybuffer
at 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
buffer
size is smaller thancount
or 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:
read
in 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:
available
in classInputStream
- Returns:
- the number of bytes that can be read from this input stream.
-
markSupported
public boolean markSupported()Tests if this input stream supports themark
andreset
methods.- Overrides:
markSupported
in classInputStream
- Returns:
- always
false
.
-
close
Closes this input stream and releases any system resources associated with the stream.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in 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:
mark
in 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 themark
method was last called on this input stream. This method is not supported and will always throw anIOException
.- Overrides:
reset
in 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 RACFcom.ibm.crypto.provider.HWKeyEntry
object from the givenracfs
hash table with the specifiedkey
alias.- Parameters:
racfs
- hash table containing RACF keys and certificateskey
- alias of the RACF entry to getpasswd
- password protecting the RACF key- Returns:
- the constructed
com.ibm.crypto.provider.HWKeyEntry
object. - Throws:
IllegalArgumentException
- if racfs is nullIOException
- if an I/O error is detected.
-