Package com.itextpdf.signatures
Interface IExternalSignature
- All Known Implementing Classes:
-
PrivateKeySignature
public interface IExternalSignature
Interface that needs to be implemented to do the actual signing. For instance: you'll have to implement this interface if you want to sign a PDF using a smart card.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the digest algorithm.Returns the signature algorithm used for signing, disregarding the digest function.Return the algorithm parameters that need to be encoded together with the signature mechanism identifier.byte[]
sign
(byte[] message) Signs the given message using the encryption algorithm in combination with the hash algorithm.
-
Method Details
-
getDigestAlgorithmName
String getDigestAlgorithmName()Returns the digest algorithm.- Returns:
- The digest algorithm (e.g. "SHA-1", "SHA-256,...").
-
getSignatureAlgorithmName
String getSignatureAlgorithmName()Returns the signature algorithm used for signing, disregarding the digest function.- Returns:
- The signature algorithm ("RSA", "DSA", "ECDSA", "Ed25519" or "Ed448").
-
getSignatureMechanismParameters
ISignatureMechanismParams getSignatureMechanismParameters()Return the algorithm parameters that need to be encoded together with the signature mechanism identifier. If there are no parameters, return `null`. A non-null value is required for RSASSA-PSS; seeRSASSAPSSMechanismParams
.- Returns:
- algorithm parameters
-
sign
Signs the given message using the encryption algorithm in combination with the hash algorithm.- Parameters:
-
message
- The message you want to be hashed and signed. - Returns:
- A signed message digest.
- Throws:
-
GeneralSecurityException
- when requested cryptographic algorithm or security provider is not available
-