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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
getDigestAlgorithmName()
Returns the digest algorithm.java.lang.String
getSignatureAlgorithmName()
Returns the signature algorithm used for signing, disregarding the digest function.ISignatureMechanismParams
getSignatureMechanismParameters()
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 Detail
-
getDigestAlgorithmName
java.lang.String getDigestAlgorithmName()
Returns the digest algorithm.- Returns:
- The digest algorithm (e.g. "SHA-1", "SHA-256,...").
-
getSignatureAlgorithmName
java.lang.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
byte[] sign(byte[] message) throws java.security.GeneralSecurityException
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:
java.security.GeneralSecurityException
- when requested cryptographic algorithm or security provider is not available
-
-