KeyMatcher, net.sergeych.tools.Bindable, net.sergeych.tools.HashableRSAOAEPPrivateKeypublic abstract class AbstractPrivateKey extends AbstractAsymmetricKey implements net.sergeych.tools.Hashable
Important: The Key can be in not-initialized state after creation, in which case the depending
methods must throw IllegalStateException. Non-initialized state is a transient state
between creation and construction from the hash or generation new key.
Created by sergeych on 15/04/16.
MAX_SALT_LENGTHFINGERPRINT_SHA256, FINGERPRINT_SHA384, keyInfo, TYPE_PRIVATE, TYPE_PRIVATE_PASSWORD, TYPE_PRIVATE_PASSWORD_V2, TYPE_PUBLIC| Constructor | Description |
|---|---|
AbstractPrivateKey() |
| Modifier and Type | Method | Description |
|---|---|---|
abstract boolean |
canDecrypt() |
Check that this key instance is suitable for decryption too (some keys can provide
sign only functionality).
|
abstract byte[] |
decrypt(byte[] ciphertext) |
Decrypt the ciphertext.
|
abstract void |
generate(int bitStrength,
HashType mgf1HashType) |
Generate a new key pair of the specified bit strength.
|
abstract int |
getBitStrength() |
|
abstract AbstractPublicKey |
getPublicKey() |
Return valid public key, for example self, or raise the exception.
|
abstract boolean |
isInitialized() |
True if the key is properly initialized.
|
byte[] |
sign(byte[] data,
HashType hashType) |
Digitally sign data in array.
|
byte[] |
sign(byte[] data,
HashType hashType,
@org.checkerframework.checker.nullness.qual.Nullable byte[] salt) |
Digitally sign data in array.
|
byte[] |
sign(java.io.InputStream input,
HashType hashType) |
Sign the source document represented by the input stream.
|
abstract byte[] |
sign(java.io.InputStream input,
HashType hashType,
@org.checkerframework.checker.nullness.qual.Nullable byte[] salt) |
Sign the source document represented by the input stream.
|
byte[] |
sign(java.lang.String data,
HashType hashType) |
Digitally sign a string encoded in UTF-8.
|
byte[] |
sign(java.lang.String data,
HashType hashType,
@org.checkerframework.checker.nullness.qual.Nullable byte[] salt) |
Digitally sign a string encoded in UTF-8.
|
getMaxSaltLengthaddress, asKeySource, canSign, createAnonymousId, encrypt, fingerprint, fromBinder, getLongAddress, getShortAddress, info, isMatchingKey, isMatchingKeyAddress, isPrivate, isPublic, matchAnonymousId, matchTag, matchType, pack, packedInfo, packToBase64String, setTag, setTag, toBinder, toString, unpack, updateDigestWithKeyComponents, updateFrom, verify, verify, verifypublic abstract void generate(int bitStrength,
HashType mgf1HashType)
The private key instance should have empty constructor (non initialized instance).
bitStrength - bit strength of the key, e.g. 2048 ro RSA.mgf1HashType - hash function used for MGF1 (normally this is SHA1).public abstract boolean isInitialized()
Hashablepublic abstract int getBitStrength()
public abstract AbstractPublicKey getPublicKey() throws java.lang.IllegalStateException
AbstractKeyAbstractKey.isPublic() or throws an exception.getPublicKey in class AbstractKeyjava.lang.IllegalStateExceptionpublic abstract boolean canDecrypt()
public abstract byte[] decrypt(byte[] ciphertext)
throws EncryptionError
decrypt in class AbstractKeyciphertext - to decryptEncryptionError - if any error prevents decryption (incorrect block data, block too short and like)public abstract byte[] sign(java.io.InputStream input,
HashType hashType,
@org.checkerframework.checker.nullness.qual.Nullable byte[] salt)
throws java.io.IOException
input - document to signsalt - salt to use; may be null, then it is generated automatically with the maximum possible size.java.io.IOException - if the document can't be read, is empty and like.public byte[] sign(java.io.InputStream input,
HashType hashType)
throws java.io.IOException
sign in class AbstractKeyinput - document to signjava.io.IOException - if the document can't be read, is empty and like.public byte[] sign(byte[] data,
HashType hashType,
@org.checkerframework.checker.nullness.qual.Nullable byte[] salt)
data - to signsalt - salt to use; may be null, then it is generated automatically with the maximum possible size.public byte[] sign(byte[] data,
HashType hashType)
sign in class AbstractKeydata - to signpublic byte[] sign(java.lang.String data,
HashType hashType,
@org.checkerframework.checker.nullness.qual.Nullable byte[] salt)
data - to signsalt - salt to use; may be null, then it is generated automatically with the maximum possible size.public byte[] sign(java.lang.String data,
HashType hashType)
data - to sign