### Eclipse Workspace Patch 1.0
#P djigzo
Index: conf/james/SAR-INF/config.xml
===================================================================
--- conf/james/SAR-INF/config.xml	(revision 8924)
+++ conf/james/SAR-INF/config.xml	(working copy)
@@ -1506,7 +1506,131 @@
             </mailet>
         </processor>
                     
+        <processor name="PGPForceSign">
+            <mailet match="SenderEvaluateUserProperty=matchOnError=false,#{user.pgp.autoRequestKey}=='true'" 
+                    class="RequestSenderPGPKey">
+                <log> Check for sender PGP key and request one if required </log>
+                <!-- If sender already has a valid key do not request another -->
+                <skipIfAvailable>true</skipIfAvailable>
+                <!-- Add the user object if a key was requested for the sender -->
+                <addUser>true</addUser>
+            </mailet>
+
+            <!-- Check for the signing algorithms from most likely to less likely (for optimization) -->
+            <mailet match="RecipientEvaluateUserProperty=matchOnError=false,#{user.pgp.signingAlgorithm}=='SHA256'"
+                    class="SetAttributes">
+                <runtime.pgp.signingAlgorithm> SHA256 </runtime.pgp.signingAlgorithm>
+                <processor> PGPMIMEForceSignCheckEncoding </processor>                                     
+            </mailet>
+
+            <mailet match="RecipientEvaluateUserProperty=matchOnError=false,#{user.pgp.signingAlgorithm}=='RIPEMD160'"
+                    class="SetAttributes">
+                <runtime.pgp.signingAlgorithm> RIPEMD160 </runtime.pgp.signingAlgorithm>
+                <processor> PGPMIMEForceSignCheckEncoding </processor>                                     
+            </mailet>
+
+            <mailet match="RecipientEvaluateUserProperty=matchOnError=false,#{user.pgp.signingAlgorithm}=='SHA512'"
+                    class="SetAttributes">
+                <runtime.pgp.signingAlgorithm> SHA512 </runtime.pgp.signingAlgorithm>
+                <processor> PGPMIMEForceSignCheckEncoding </processor>                                     
+            </mailet>
+
+            <mailet match="RecipientEvaluateUserProperty=matchOnError=false,#{user.pgp.signingAlgorithm}=='SHA1'"
+                    class="SetAttributes">
+                <runtime.pgp.signingAlgorithm> SHA1 </runtime.pgp.signingAlgorithm>
+                <processor> PGPMIMEForceSignCheckEncoding </processor>                                     
+            </mailet>
+            
+            <mailet match="All" class="Log">
+                <comment> no matching PGP signing algorithm found. Using default SHA256. </comment>
+                <logLevel> WARN </logLevel>
+            </mailet>                                             
+
+            <mailet match="All" class="GotoProcessor">
+                <processor> PGPMIMEForceSignCheckEncoding </processor>
+            </mailet>
+        </processor>
+
+        <processor name="PGPMIMEForceSignCheckEncoding">
+            <mailet match="RecipientEvaluateUserProperty=matchOnError=false,#{user.pgp.encoding}=='PGP_INLINE'"
+                    class="GotoProcessor">
+                <processor> PGPInlineForceSign </processor>                                     
+            </mailet>
+            
+            <mailet match="All" class="GotoProcessor">
+                <processor> PGPMIMEForceSign </processor>
+            </mailet>
+        </processor>
+                                          
+        <processor name="PGPMIMEForceSign">
+            <mailet match="All" class="PGPMIMESign">
+                <log> Trying to PGP/MIME sign the message </log>
+                <!-- 
+                    The default signing algorithm if the algorithmAttribute does not specify a signing algorithm.
+                -->
+                <signingAlgorithm> SHA256 </signingAlgorithm>
+                <signingAlgorithmAttribute> runtime.pgp.signingAlgorithm </signingAlgorithmAttribute>
+            </mailet>
+
+            <mailet match="All" class="GotoProcessor">
+                <processor> transport </processor>
+            </mailet>            
+        </processor>
+                     
+        <processor name="PGPInlineForceSign">
+            <mailet match="RecipientEvaluateUserProperty=matchOnError=true,#{user.pgp.convertHTMLToText}!='true'" 
+                    class="SetAttributes">
+                <log> HTML parts will not be converted to text </log>
+                <runtime.pgp.convertHTMLToText> false </runtime.pgp.convertHTMLToText>
+            </mailet>
+            
+            <mailet match="All" class="PGPInlineBuilder">
+                <log> Trying to PGP/INLINE sign the message </log>
+                <!-- 
+                    The default signing algorithm if the algorithmAttribute does not specify a signing algorithm.
+                -->
+                <signingAlgorithm> SHA256 </signingAlgorithm>
+                <signingAlgorithmAttribute> runtime.pgp.signingAlgorithm </signingAlgorithmAttribute>
+                <!-- 
+                    The encryption algorithm
+                -->
+                <encryptionAlgorithm> NULL </encryptionAlgorithm>
+
+                <!-- 
+                    The compression algorithm
+                -->
+                <compressionAlgorithm> UNCOMPRESSED </compressionAlgorithm>
+                
+                <!-- 
+                    By default, convert HTML parts to text
+                -->
+                <convertHTMLToText> true </convertHTMLToText>
+                <convertHTMLToTextAttribute> runtime.pgp.convertHTMLToText </convertHTMLToTextAttribute>
+                                
+                <!-- 
+                    the next processor after the message has been signed 
+                -->
+                <signedProcessor> transport </signedProcessor>
+            </mailet>
+
+            <mailet match="All" class="Log">
+                <comment> PGP/INLINE signing failed. </comment>
+                <logLevel> WARN </logLevel>
+            </mailet>                                             
+
+            <mailet match="All" class="GotoProcessor">
+                <processor> transport </processor>
+            </mailet>            
+        </processor>                     
+                            
         <processor name="checkSMIMESign">
+        
+            <!-- ADDED TO FORCE PGP SIGN IF CUSTOM PROPERTY IS SET -->
+            <mailet match="SenderEvaluateUserProperty=matchOnError=false,#{user.custom.1}=='true'" class="GotoProcessor">
+                <log> PGP Sign only forced for sender </log>
+                <processor> PGPForceSign </processor>
+            </mailet>
+                
             <mailet match="SenderEvaluateUserProperty=matchOnError=true,#{user.onlySignWhenEncrypt}=='true'" 
                     class="GotoProcessor">
                 <log> "only sign when encrypt" is enabled for the sender. S/MIME signing will be skipped </log>

