Modifier and Type | Method and Description |
---|---|
byte[] |
decryptSecret(java.security.Signature signature,
java.lang.String cipherInfoCipherName,
byte[] encryptedSecret)
Decrypts an encrypted secret, encryption of which was done using the public key corresponding to the private key we also use to sign messages with
|
static Signer |
getInstance()
Gets the instance
|
byte[] |
sign(java.security.Signature signature,
byte[] signMessage)
Computes the signature for the given byte string and the given Signature.
|
public static Signer getInstance()
public byte[] decryptSecret(java.security.Signature signature, java.lang.String cipherInfoCipherName, byte[] encryptedSecret) throws java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, javax.crypto.NoSuchPaddingException, NotFoundException, javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException
Signer
decryptSecret
in interface Signer
signature
- The Signature object to be used for computing the signature.cipherInfoCipherName
- The name of the Cipher used to encrypt the secretencryptedSecret
- A secret to be shared between [the user of] this signer and a party we are communicating with, and who generated the secret, encrypting it with our public key.java.security.InvalidKeyException
- If the public key in the given certificate is inappropriate for initializing this cipher, or this cipher requires algorithm parameters that cannot be determined from the public key in the given certificate, or the keysize of the public key in the given certificate has a keysize that exceeds the maximum allowable keysize (as determined by the configured jurisdiction policy files).java.security.NoSuchAlgorithmException
- If the cipherInfoCipherName does not indicate a usable Cipher namejavax.crypto.NoSuchPaddingException
- If the cipherInfoCipherName does not indicate a usable Cipher nameNotFoundException
- If the private key to be used for the decryption could not be foundjavax.crypto.IllegalBlockSizeException
- If cipherInfoCipherName indicates a block cipher, no padding has been requested (only in encryption mode), and the total input length of the data processed by this cipher is not a multiple of block size; or if this encryption algorithm is unable to process the input data provided.javax.crypto.BadPaddingException
- If this cipher is in decryption mode, and (un)padding has been requested, but the decrypted data is not bounded by the appropriate padding bytespublic byte[] sign(java.security.Signature signature, byte[] signMessage) throws java.security.InvalidKeyException, java.security.SignatureException, NotFoundException
Signer
sign
in interface Signer
signature
- The Signature object to be used for computing the signature.signMessage
- The message to be signed.java.security.InvalidKeyException
- If the private key found for signing with this Signature, turns out to be invalidjava.security.SignatureException
- If any problem occurred during computation of the signatureNotFoundException
- If no private key could be found for signing with this Signature