KeyMatcher, net.sergeych.tools.Bindable, net.sergeych.tools.Hashablepublic class RSAOAEPPrivateKey extends AbstractPrivateKey
Created by amyodov on 16.04.16.
| Modifier and Type | Field | Description |
|---|---|---|
static HashType |
DEFAULT_MGF1_HASH |
The default MGF1 hash algorithm.
|
static HashType |
DEFAULT_OAEP_HASH |
The default hash algorithm for OAEP.
|
MAX_SALT_LENGTHFINGERPRINT_SHA256, FINGERPRINT_SHA384, keyInfo, TYPE_PRIVATE, TYPE_PRIVATE_PASSWORD, TYPE_PRIVATE_PASSWORD_V2, TYPE_PUBLIC| Constructor | Description |
|---|---|
RSAOAEPPrivateKey() |
Empty constructor.
|
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
canDecrypt() |
Check that this key instance is suitable for decryption too (some keys can provide
sign only functionality).
|
byte[] |
decrypt(byte[] ciphertext) |
Decrypt the ciphertext.
|
void |
generate(int bitStrength,
byte[] e,
int certainty,
HashType oaepHashType,
HashType mgf1HashType) |
Generate a new key pair, with all options specified.
|
void |
generate(int bitStrength,
HashType mgf1HashType) |
Generate a new key pair of the specified bit strength.
|
int |
getBitStrength() |
|
AbstractPublicKey |
getPublicKey() |
Return valid public key, for example self, or raise the exception.
|
boolean |
isInitialized() |
True if the key is properly initialized.
|
byte[] |
pack() |
|
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.
|
@NonNull java.util.Map<java.lang.String,java.lang.Object> |
toHash() |
|
java.lang.String |
toString() |
|
void |
updateFromHash(java.util.Map<java.lang.String,java.lang.Object> hash) |
getMaxSaltLengthaddress, asKeySource, canSign, createAnonymousId, encrypt, fingerprint, fromBinder, getLongAddress, getShortAddress, info, isMatchingKey, isMatchingKeyAddress, isPrivate, isPublic, matchAnonymousId, matchTag, matchType, packedInfo, packToBase64String, setTag, setTag, toBinder, unpack, updateDigestWithKeyComponents, updateFrom, verify, verify, verifypublic static final HashType DEFAULT_OAEP_HASH
public static final HashType DEFAULT_MGF1_HASH
public java.lang.String toString()
toString in class AbstractKeypublic void generate(int bitStrength,
HashType mgf1HashType)
The private key instance should have empty constructor (non initialized instance).
generate in class AbstractPrivateKeybitStrength - bit strength of the key, e.g. 2048 ro RSA.mgf1HashType - hash function used for MGF1 (normally this is SHA1).public void generate(int bitStrength,
byte[] e,
int certainty,
HashType oaepHashType,
HashType mgf1HashType)
bitStrength - bit strength of the key, e.g. 2048e - RSA public exponentcertainty - RSA key generation certaintymgf1HashType - The type of the hash(digest) function used for OAEP MGF1 hash generation.public boolean isInitialized()
HashableisInitialized in class AbstractPrivateKeypublic int getBitStrength()
throws java.lang.IllegalStateException
getBitStrength in class AbstractPrivateKeyjava.lang.IllegalStateExceptionpublic AbstractPublicKey getPublicKey() throws java.lang.IllegalStateException
AbstractKey.isPublic() or throws an exception.getPublicKey in class AbstractPrivateKeyjava.lang.IllegalStateExceptionpublic boolean canDecrypt()
canDecrypt in class AbstractPrivateKeypublic byte[] decrypt(byte[] ciphertext)
throws EncryptionError
decrypt in class AbstractPrivateKeyciphertext - to decryptEncryptionError - if any error prevents decryption (incorrect block data, block too short and like)public byte[] sign(java.io.InputStream input,
HashType hashType,
@org.checkerframework.checker.nullness.qual.Nullable byte[] salt)
throws java.lang.IllegalStateException,
java.io.IOException
Signature is created using RSA-PSS as described in PKCS# 1 v 2.1.
sign in class AbstractPrivateKeyinput - 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.java.lang.IllegalStateExceptionpublic @NonNull java.util.Map<java.lang.String,java.lang.Object> toHash()
throws java.lang.IllegalStateException
java.lang.IllegalStateExceptionpublic void updateFromHash(java.util.Map<java.lang.String,java.lang.Object> hash)
throws net.sergeych.tools.Hashable.Error
net.sergeych.tools.Hashable.Errorpublic byte[] pack()
pack in class AbstractKey