Package org.apache.james.jdkim
Class IscheduleDKIMSigner
- java.lang.Object
-
- org.apache.james.jdkim.DKIMCommon
-
- org.apache.james.jdkim.IscheduleDKIMSigner
-
public class IscheduleDKIMSigner extends DKIMCommon
Variation on the DKIMSigner class which handles ischdule (http) data
-
-
Field Summary
-
Fields inherited from class org.apache.james.jdkim.DKIMCommon
deepDebug
-
-
Constructor Summary
Constructors Constructor Description IscheduleDKIMSigner(String signatureRecordTemplate, PrivateKey privateKey)
IscheduleDKIMSigner(PrivateKey privateKey)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PrivateKey
getPrivateKey(String privateKeyPKCS8)
Generate a PrivateKey from a Base64 encoded private key.BodyHasher
newBodyHasher(SignatureRecord signRecord)
SignatureRecord
newSignatureRecordTemplate(String record)
String
sign(Headers headers, InputStream is)
String
sign(Headers reqHeaders, BodyHasher bh)
-
Methods inherited from class org.apache.james.jdkim.DKIMCommon
debugMsg, signatureCheck, streamCopy, trace, updateSignature
-
-
-
-
Constructor Detail
-
IscheduleDKIMSigner
public IscheduleDKIMSigner(PrivateKey privateKey)
-
IscheduleDKIMSigner
public IscheduleDKIMSigner(String signatureRecordTemplate, PrivateKey privateKey)
-
-
Method Detail
-
newSignatureRecordTemplate
public SignatureRecord newSignatureRecordTemplate(String record)
-
newBodyHasher
public BodyHasher newBodyHasher(SignatureRecord signRecord) throws PermFailException
- Throws:
PermFailException
-
sign
public String sign(Headers headers, InputStream is) throws IOException, FailException
- Parameters:
headers
- http headersis
- stream for content.- Returns:
- the dkim signature header
- Throws:
IOException
- on errorFailException
- on error
-
sign
public String sign(Headers reqHeaders, BodyHasher bh) throws PermFailException
- Throws:
PermFailException
-
getPrivateKey
public static PrivateKey getPrivateKey(String privateKeyPKCS8) throws NoSuchAlgorithmException, InvalidKeySpecException
Generate a PrivateKey from a Base64 encoded private key. In order to generate a valid PKCS8 key when you have a PEM key you can do this:openssl pkcs8 -topk8 -inform PEM -in rsapriv.pem -outform DER -nocrypt -out rsapriv.der
And then base64 encode the content.- Parameters:
privateKeyPKCS8
- a Base64 encoded string of the RSA key in PKCS8 format- Returns:
- the PrivateKey
- Throws:
NoSuchAlgorithmException
- if RSA is unknownInvalidKeySpecException
- on bad input key
-
-