public class PrivateKey extends SimpleDataStructure implements Destroyable
Modifier and Type | Field and Description |
---|---|
static int |
KEYSIZE_BYTES |
_data
Constructor and Description |
---|
PrivateKey() |
PrivateKey(byte[] data) |
PrivateKey(EncType type) |
PrivateKey(EncType type,
byte[] data) |
PrivateKey(String base64Data)
constructs from base64
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
javax.security.auth.Destroyable interface
|
boolean |
equals(Object obj)
Warning - this returns true for two different classes with the same size
and same data, e.g.
|
EncType |
getType() |
int |
hashCode()
We assume the data has enough randomness in it, so use the last 4 bytes for speed.
|
boolean |
isDestroyed()
javax.security.auth.Destroyable interface
|
int |
length()
The legal length of the byte array in this data structure
|
PublicKey |
toPublic()
derives a new PublicKey object derived from the secret contents
of this PrivateKey
|
String |
toString() |
calculateHash, fromBase64, fromByteArray, getData, readBytes, setData, toBase64, toByteArray, writeBytes
read
public PrivateKey()
public PrivateKey(EncType type)
type
- non-nullpublic PrivateKey(byte[] data)
public PrivateKey(EncType type, byte[] data)
type
- non-nulldata
- must be non-nullpublic PrivateKey(String base64Data) throws DataFormatException
base64Data
- a string of base64 data (the output of .toBase64() called
on a prior instance of PrivateKeyDataFormatException
public int length()
SimpleDataStructure
length
in class SimpleDataStructure
public EncType getType()
public PublicKey toPublic()
IllegalArgumentException
- on bad keypublic void destroy()
destroy
in interface Destroyable
public boolean isDestroyed()
isDestroyed
in interface Destroyable
public String toString()
toString
in class SimpleDataStructure
public int hashCode()
hashCode
in class SimpleDataStructure
public boolean equals(Object obj)
SimpleDataStructure
equals
in class SimpleDataStructure