KeyMatcher, net.sergeych.tools.Bindablepublic class PrivateKey extends AbstractKey
Created by sergeych on 02/12/16.
| Modifier and Type | Class | Description |
|---|---|---|
static class |
PrivateKey.PasswordProtectedException |
FINGERPRINT_SHA256, FINGERPRINT_SHA384, keyInfo, TYPE_PRIVATE, TYPE_PRIVATE_PASSWORD, TYPE_PRIVATE_PASSWORD_V2, TYPE_PUBLIC| Constructor | Description |
|---|---|
PrivateKey() |
Used to load stored keys, see
Bindable in AbstractKey. |
PrivateKey(byte[] packedBinaryKey) |
|
PrivateKey(byte[] packedBinaryKey,
KeyInfo info) |
|
PrivateKey(int bitStrength) |
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
canSign() |
If it is an instance of the private key, it will return true, then
AbstractKey.getPublicKey() must return valid
key. |
byte[] |
decrypt(byte[] encrypted) |
|
boolean |
equals(java.lang.Object obj) |
|
byte[] |
fingerprint() |
The fingerprint of the key is a uniqie sequence of bytes that matches the key without compromising it.
|
static PrivateKey |
fromPath(java.nio.file.Path path) |
|
PublicKey |
getPublicKey() |
Return valid public key, for example self, or raise the exception.
|
int |
hashCode() |
|
KeyInfo |
info() |
|
boolean |
isPrivate() |
|
byte[] |
pack() |
|
byte[] |
packWithPassword(java.lang.String password) |
|
byte[] |
packWithPassword(java.lang.String password,
int rounds) |
|
byte[] |
sign(java.io.InputStream input,
HashType hashType) |
|
static PrivateKey |
unpackWithPassword(byte[] packedBinary,
java.lang.String password) |
|
Digest |
updateDigestWithKeyComponents(Digest digest) |
Arbitrary fingerprint calculation.
|
address, asKeySource, createAnonymousId, encrypt, fromBinder, getLongAddress, getShortAddress, isMatchingKey, isMatchingKeyAddress, isPublic, matchAnonymousId, matchTag, matchType, packedInfo, packToBase64String, setTag, setTag, sign, toBinder, toString, unpack, updateFrom, verify, verify, verifypublic PrivateKey(byte[] packedBinaryKey,
KeyInfo info)
throws EncryptionError
EncryptionErrorpublic PrivateKey(byte[] packedBinaryKey)
throws EncryptionError
EncryptionErrorpublic PrivateKey(int bitStrength)
public PrivateKey()
public boolean canSign()
AbstractKeyAbstractKey.getPublicKey() must return valid
key.canSign in class AbstractKeypublic boolean isPrivate()
isPrivate in class AbstractKeypublic byte[] decrypt(byte[] encrypted)
throws EncryptionError
decrypt in class AbstractKeyEncryptionErrorpublic PublicKey getPublicKey()
AbstractKeyAbstractKey.isPublic() or throws an exception.getPublicKey in class AbstractKeypublic byte[] pack()
pack in class AbstractKeypublic byte[] sign(java.io.InputStream input,
HashType hashType)
throws EncryptionError,
java.io.IOException
sign in class AbstractKeyEncryptionErrorjava.io.IOExceptionpublic KeyInfo info()
info in class AbstractKeypublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic byte[] fingerprint()
AbstractKey
Therefore, the private key fingerprint is its public key fingerprint. The public key fingerprint is calculated
using some hash over it's parameters, see PublicKey.fingerprint()
fingerprint in class AbstractKeypublic static PrivateKey fromPath(java.nio.file.Path path) throws java.io.IOException
java.io.IOExceptionpublic Digest updateDigestWithKeyComponents(Digest digest)
AbstractKeyCreate any digest you need and call this method to update it with a ket data.
This can and should be used to obtain higher-order composite fingerprints for high security setups.
updateDigestWithKeyComponents in class AbstractKeypublic byte[] packWithPassword(java.lang.String password)
throws EncryptionError
EncryptionErrorpublic byte[] packWithPassword(java.lang.String password,
int rounds)
throws EncryptionError
EncryptionErrorpublic static PrivateKey unpackWithPassword(byte[] packedBinary, java.lang.String password) throws EncryptionError
EncryptionError