小编Jak*_*b C的帖子

MBean持久性

我的配置MBean的持久性存在问题.我的配置:

<bean id="adminMBean" class="pl.mobileexperts.catchme.mbeans.AdminSettingsMBean"></bean>

<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
    <property name="assembler" ref="assembler" />
    <property name="autodetect" value="true" />
    <property name="namingStrategy" ref="namingStrategy"/>
</bean>

<bean id="attributeSource" class="org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource" />
<bean id="namingStrategy" class="org.springframework.jmx.export.naming.MetadataNamingStrategy">
    <property name="attributeSource" ref="attributeSource" />
</bean>
<bean id="assembler" class="org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler">
    <property name="attributeSource" ref="attributeSource" />
</bean>
Run Code Online (Sandbox Code Playgroud)
 @ManagedResource(objectName = "pl.mobileexperts.catchme:name=adminMBean",
 description  ="admin settings",
 persistPolicy = "OnUpdate",
 persistLocation = "c:/", persistName = "adminSettings.jmx")
 public class AdminSettingsMBean {

      private boolean moderatorModeEnabled;

      public AdminSettingsMBean() {
      }

      @ManagedAttribute(persistPolicy = "OnUpdate")
      public boolean isModeratorModeEnabled() {
        return moderatorModeEnabled;
      }

      @ManagedAttribute(persistPolicy = "OnUpdate")
      public void …
Run Code Online (Sandbox Code Playgroud)

java spring jmx jboss5.x

34
推荐指数
1
解决办法
2670
查看次数

如何使用pdfbox在Java中签署pdf

我正在尝试使用pdfbox库签署pdf.我现在卡住了,真的需要帮助.

这是我的代码:

private static void signPdf(PDDocument document) throws Exception 
{
    PDSignature sig = new PDSignature();
    sig.setFilter(COSName.ADOBE_PPKLITE);
    sig.setSubFilter(COSName.ADBE_PKCS7_DETACHED);
    sig.setByteRange(new int[] {'a','a','a','a'});
    sig.setContents(new byte[]{(byte) 23, (byte) 23, (byte) 23, (byte) 23});

    SignatureOptions options = new SignatureOptions();

    document.addSignature(sig, new SignatureInterface() {
        public byte[] sign(InputStream content)
                throws SignatureException, IOException       {        
             //this should be made MD5 checksum?           
            return new byte[]{(byte) 'a', (byte) 'a', (byte) 'a', (byte) 'a'};
        }
    }, options);
}
Run Code Online (Sandbox Code Playgroud)

然后我保存我的pdf,但是:1)我注意到从未调用过sign方法2)我应该在哪里附加certyficate?在签名方法?

PDF格式:

/Type /Sig
/Filter /Adobe.PPKLite
/SubFilter /adbe.pkcs7.sha1
/Contents <0000000000. a lot of zeros..000> …
Run Code Online (Sandbox Code Playgroud)

pdf sign certificate pdfbox pkcs#7

12
推荐指数
1
解决办法
2万
查看次数

标签 统计

certificate ×1

java ×1

jboss5.x ×1

jmx ×1

pdf ×1

pdfbox ×1

pkcs#7 ×1

sign ×1

spring ×1