public class PublicKey extends Object
| Constructor and Description |
|---|
PublicKey() |
PublicKey(Blob keyDer)
Create a new PublicKey by decoding the keyDer.
|
| Modifier and Type | Method and Description |
|---|---|
Blob |
encrypt(Blob plainData,
EncryptAlgorithmType algorithmType)
Encrypt the plainData using the keyBits according the encrypt algorithm type.
|
Blob |
encrypt(byte[] plainData,
EncryptAlgorithmType algorithmType)
Encrypt the plainData using the keyBits according the encrypt algorithm type.
|
Blob |
getDigest() |
Blob |
getDigest(DigestAlgorithm digestAlgorithm) |
Blob |
getKeyDer() |
KeyType |
getKeyType() |
DerNode |
toDer()
Encode the public key into DER.
|
public PublicKey()
public PublicKey(Blob keyDer) throws UnrecognizedKeyFormatException
keyDer - The blob of the SubjectPublicKeyInfo DER.UnrecognizedKeyFormatException - if can't decode the key DER.public final DerNode toDer() throws DerDecodingException
DerDecodingExceptionpublic KeyType getKeyType()
public final Blob getDigest(DigestAlgorithm digestAlgorithm) throws UnrecognizedDigestAlgorithmException
public final Blob getDigest()
public final Blob getKeyDer()
public Blob encrypt(byte[] plainData, EncryptAlgorithmType algorithmType) throws InvalidKeySpecException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
plainData - The data to encrypt.algorithmType - This encrypts according to the algorithm type, e.g.,
RsaOaep.InvalidKeySpecExceptionNoSuchAlgorithmExceptionNoSuchPaddingExceptionInvalidKeyExceptionIllegalBlockSizeExceptionBadPaddingExceptionpublic Blob encrypt(Blob plainData, EncryptAlgorithmType algorithmType) throws InvalidKeySpecException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
plainData - The data to encrypt.algorithmType - This encrypts according to the algorithm type, for
example RsaOaep.InvalidKeySpecExceptionNoSuchAlgorithmExceptionNoSuchPaddingExceptionInvalidKeyExceptionIllegalBlockSizeExceptionBadPaddingExceptionCopyright © 2019. All rights reserved.