org.apache.james.jdkim
Class DKIMSigner
java.lang.Object
org.apache.james.jdkim.DKIMCommon
org.apache.james.jdkim.DKIMSigner
public class DKIMSigner
- extends DKIMCommon
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DKIMSigner
public DKIMSigner(String signatureRecordTemplate,
PrivateKey privateKey)
newSignatureRecordTemplate
public SignatureRecord newSignatureRecordTemplate(String record)
newBodyHasher
public BodyHasher newBodyHasher(SignatureRecord signRecord)
throws PermFailException
- Throws:
PermFailException
sign
public String sign(InputStream is)
throws IOException,
FailException
- Throws:
IOException
FailException
sign
public String sign(Headers message,
BodyHasher bhj)
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 unknown
InvalidKeySpecException
- on bad input key
Copyright © 2008-2009 The Apache Software Foundation. All Rights Reserved.