• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SMIMESigned类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.bouncycastle.mail.smime.SMIMESigned的典型用法代码示例。如果您正苦于以下问题:Java SMIMESigned类的具体用法?Java SMIMESigned怎么用?Java SMIMESigned使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SMIMESigned类属于org.bouncycastle.mail.smime包,在下文中一共展示了SMIMESigned类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: unsign

import org.bouncycastle.mail.smime.SMIMESigned; //导入依赖的package包/类
/**
 * Unsigns the encapsulated MIME body part.
 * 
 * @return the an S/MIME message encapsulating the signed content.
 * @throws SMimeException if unable to unsign the body part.
 */
public SMimeMessage unsign() throws SMimeException {
    try {
        setDefaults();

        SMIMESigned signed = new SMIMESigned((MimeMultipart)bodyPart.getContent());
        MimeBodyPart signedPart = signed.getContent();
        if (signedPart == null) {
            throw new SMimeException("No signed part");
        }
        return new SMimeMessage(signedPart, this);
    }
    catch (Exception e) {
        if (e instanceof CMSException) {
            e = ((CMSException)e).getUnderlyingException();
        }
        throw new SMimeException("Unable to unsign body part", e);
    }
}
 
开发者ID:cecid,项目名称:hermes,代码行数:25,代码来源:SMimeMessage.java


示例2: getSubjectCertificate

import org.bouncycastle.mail.smime.SMIMESigned; //导入依赖的package包/类
private X509Certificate getSubjectCertificate()
{
    if (message != null)
    {
        try
        {
            SMIMESigned signed = new SMIMESigned((MimeMultipart)message.getContent());
            Iterator<?> it = signed.getSignerInfos().getSigners().iterator();
            CertStore certsAndCRLs = signed.getCertificatesAndCRLs("Collection", "BC");
            
            while (it.hasNext()) 
            {
                SignerInformation signer = (SignerInformation) it.next();
                return (X509Certificate) certsAndCRLs.getCertificates(signer.getSID()).iterator().next();
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
    else
        return (X509Certificate) chain[0];
    
    return null;
}
 
开发者ID:edeoliveira,项目名称:Mailster,代码行数:27,代码来源:CertificateDialog.java


示例3: getSMIMESignedMessage

import org.bouncycastle.mail.smime.SMIMESigned; //导入依赖的package包/类
private SMIMESigned getSMIMESignedMessage( Package source ) throws ActionException {

        //first make sure we have a MimePackage
        try {
            MimePackage mimePackage = (MimePackage) source;
            return mimePackage.getSMIMESignedMessage();
        } catch (ClassCastException cce) {
            throw new ActionException("Source package " + source.getDescription()
                                      + " is not a MIME package");
        }
    }
 
开发者ID:Axway,项目名称:ats-framework,代码行数:12,代码来源:SMimePackageEncryptor.java


示例4: verify

import org.bouncycastle.mail.smime.SMIMESigned; //导入依赖的package包/类
public void verify(X509Certificate cert) throws SFRMException {
      try {
          SMIMESigned signed = new SMIMESigned((MimeMultipart)bodyPart.getContent());
          SignerInformationStore signers = signed.getSignerInfos();
          Iterator signerInfos = signers.getSigners().iterator();
      
          while (signerInfos.hasNext()) {
              SignerInformation signerInfo = (SignerInformation)signerInfos.next();
SignerInformationVerifier verifier =
    new BcRSASignerInfoVerifierBuilder(new DefaultCMSSignatureAlgorithmNameGenerator(),
				  new DefaultSignatureAlgorithmIdentifierFinder(),
				  new DefaultDigestAlgorithmIdentifierFinder(), 
				  new BcDigestCalculatorProvider())
    .build(new JcaX509CertificateHolder(cert));
              if (!signerInfo.verify(verifier)) {
                  throw new SFRMMessageException("Verification failed");
              }
          }
          
          MimeBodyPart signedPart = signed.getContent();
          if (signedPart == null) {
              throw new SFRMMessageException("Unable to extract signed part");
          }
          else {
          	this.bodyPart = signedPart;
          	this.setIsSigned(true);
          }
          
  	} catch (org.bouncycastle.cms.CMSException ex) {
  		throw new SFRMException("Unable to verify body part", ex.getUnderlyingException());
      } catch (Exception e) {
          throw new SFRMException("Unable to verify body part", e);
      }
  }
 
开发者ID:cecid,项目名称:hermes,代码行数:35,代码来源:SFRMMessage.java


示例5: testGOST3411WithECGOST3410

import org.bouncycastle.mail.smime.SMIMESigned; //导入依赖的package包/类
public void testGOST3411WithECGOST3410()
    throws Exception
{
    MimeMultipart smm = generateMultiPartECGost(msg);
    SMIMESigned   s = new  SMIMESigned(smm);

    assertEquals("gostr3411-94", getMicAlg(smm));
    assertEquals(getDigestOid(s.getSignerInfos()), CryptoProObjectIdentifiers.gostR3411.getId());

    verifyMessageBytes(msg, s.getContent());

    verifySigners(s.getCertificatesAndCRLs("Collection", "BC"), s.getSignerInfos());
}
 
开发者ID:mlundblad,项目名称:bc-java,代码行数:14,代码来源:SMIMESignedTest.java


示例6: testSHA1WithRSA

import org.bouncycastle.mail.smime.SMIMESigned; //导入依赖的package包/类
public void testSHA1WithRSA()
    throws Exception
{
    MimeMultipart smm = generateMultiPartRsa("SHA1withRSA", msg, SMIMESignedGenerator.RFC3851_MICALGS);
    SMIMESigned   s = new SMIMESigned(smm);

    verifyMessageBytes(msg, s.getContent());

    verifySigners(s.getCertificates(), s.getSignerInfos());
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:11,代码来源:NewSMIMESignedTest.java


示例7: testGOST3411WithGOST3410

import org.bouncycastle.mail.smime.SMIMESigned; //导入依赖的package包/类
public void testGOST3411WithGOST3410()
    throws Exception
{
    MimeMultipart smm = generateMultiPartGost(msg);
    SMIMESigned   s = new  SMIMESigned(smm);

    assertEquals("gostr3411-94", getMicAlg(smm));
    assertEquals(getDigestOid(s.getSignerInfos()), CryptoProObjectIdentifiers.gostR3411.getId());

    verifyMessageBytes(msg, s.getContent());

    verifySigners(s.getCertificatesAndCRLs("Collection", "BC"), s.getSignerInfos());
}
 
开发者ID:mlundblad,项目名称:bc-java,代码行数:14,代码来源:SMIMESignedTest.java


示例8: testSHA1WithRSAEncapsulated

import org.bouncycastle.mail.smime.SMIMESigned; //导入依赖的package包/类
public void testSHA1WithRSAEncapsulated()
    throws Exception
{
    MimeBodyPart res = generateEncapsulatedRsa("SHA1withRSA", msg);
    SMIMESigned  s = new SMIMESigned(res);

    verifyMessageBytes(msg, s.getContent());

    verifySigners(s.getCertificates(), s.getSignerInfos());
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:11,代码来源:NewSMIMESignedTest.java


示例9: testMultiAlternative

import org.bouncycastle.mail.smime.SMIMESigned; //导入依赖的package包/类
public void testMultiAlternative()
    throws Exception
{
    MimeMessage message = loadMessage("multi-alternative.eml");

    SMIMESigned s = new SMIMESigned((MimeMultipart)message.getContent());

    verifySigners(s.getCertificatesAndCRLs("Collection", "BC"), s.getSignerInfos());
}
 
开发者ID:mlundblad,项目名称:bc-java,代码行数:10,代码来源:SMIMESignedTest.java


示例10: testSHA224WithRSA

import org.bouncycastle.mail.smime.SMIMESigned; //导入依赖的package包/类
public void testSHA224WithRSA()
    throws Exception
{
    MimeMultipart smm = generateMultiPartRsa("SHA224withRSA", msg, SMIMESignedGenerator.STANDARD_MICALGS);
    SMIMESigned   s = new  SMIMESigned(smm);

    assertEquals("sha-224", getMicAlg(smm));
    assertEquals(getDigestOid(s.getSignerInfos()), NISTObjectIdentifiers.id_sha224.toString());
    
    verifyMessageBytes(msg, s.getContent());

    verifySigners(s.getCertificates(), s.getSignerInfos());
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:14,代码来源:NewSMIMESignedTest.java


示例11: testSHA224WithRSARfc3851

import org.bouncycastle.mail.smime.SMIMESigned; //导入依赖的package包/类
public void testSHA224WithRSARfc3851()
    throws Exception
{
    MimeMultipart smm = generateMultiPartRsa("SHA224withRSA", msg, SMIMESignedGenerator.RFC3851_MICALGS);
    SMIMESigned   s = new  SMIMESigned(smm);

    assertEquals("sha224", getMicAlg(smm));
    assertEquals(getDigestOid(s.getSignerInfos()), NISTObjectIdentifiers.id_sha224.toString());

    verifyMessageBytes(msg, s.getContent());

    verifySigners(s.getCertificates(), s.getSignerInfos());
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:14,代码来源:NewSMIMESignedTest.java


示例12: testSHA256WithRSARfc3851

import org.bouncycastle.mail.smime.SMIMESigned; //导入依赖的package包/类
public void testSHA256WithRSARfc3851()
    throws Exception
{
    MimeMultipart smm = generateMultiPartRsa("SHA256withRSA", msg, SMIMESignedGenerator.RFC3851_MICALGS);
    SMIMESigned   s = new  SMIMESigned(smm);

    assertEquals("sha256", getMicAlg(smm));
    assertEquals(getDigestOid(s.getSignerInfos()), NISTObjectIdentifiers.id_sha256.toString());

    verifyMessageBytes(msg, s.getContent());

    verifySigners(s.getCertificates(), s.getSignerInfos());
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:14,代码来源:NewSMIMESignedTest.java


示例13: testSHA384WithRSA

import org.bouncycastle.mail.smime.SMIMESigned; //导入依赖的package包/类
public void testSHA384WithRSA()
    throws Exception
{
    MimeMultipart smm = generateMultiPartRsa("SHA384withRSA", msg, SMIMESignedGenerator.STANDARD_MICALGS);
    SMIMESigned   s = new  SMIMESigned(smm);

    assertEquals("sha-384", getMicAlg(smm));
    assertEquals(getDigestOid(s.getSignerInfos()), NISTObjectIdentifiers.id_sha384.toString());

    verifyMessageBytes(msg, s.getContent());

    verifySigners(s.getCertificates(), s.getSignerInfos());
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:14,代码来源:NewSMIMESignedTest.java


示例14: testSHA384WithRSARfc3851

import org.bouncycastle.mail.smime.SMIMESigned; //导入依赖的package包/类
public void testSHA384WithRSARfc3851()
    throws Exception
{
    MimeMultipart smm = generateMultiPartRsa("SHA384withRSA", msg, SMIMESignedGenerator.RFC3851_MICALGS);
    SMIMESigned   s = new  SMIMESigned(smm);

    assertEquals("sha384", getMicAlg(smm));
    assertEquals(getDigestOid(s.getSignerInfos()), NISTObjectIdentifiers.id_sha384.toString());

    verifyMessageBytes(msg, s.getContent());

    verifySigners(s.getCertificates(), s.getSignerInfos());
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:14,代码来源:NewSMIMESignedTest.java


示例15: testEmbeddedMulti

import org.bouncycastle.mail.smime.SMIMESigned; //导入依赖的package包/类
public void testEmbeddedMulti()
    throws Exception
{
    MimeMessage message = loadMessage("embeddedmulti.message");

    SMIMESigned s = new SMIMESigned((MimeMultipart)message.getContent());

    verifySigners(s.getCertificates(), s.getSignerInfos());
}
 
开发者ID:mlundblad,项目名称:bc-java,代码行数:10,代码来源:NewSMIMESignedTest.java


示例16: testGOST3411WithGOST3410

import org.bouncycastle.mail.smime.SMIMESigned; //导入依赖的package包/类
public void testGOST3411WithGOST3410()
    throws Exception
{
    MimeMultipart smm = generateMultiPartGost(msg);
    SMIMESigned   s = new  SMIMESigned(smm);

    assertEquals("gostr3411-94", getMicAlg(smm));
    assertEquals(getDigestOid(s.getSignerInfos()), CryptoProObjectIdentifiers.gostR3411.getId());

    verifyMessageBytes(msg, s.getContent());

    verifySigners(s.getCertificates(), s.getSignerInfos());
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:14,代码来源:NewSMIMESignedTest.java


示例17: testSHA1WithRSAEncapsulated

import org.bouncycastle.mail.smime.SMIMESigned; //导入依赖的package包/类
public void testSHA1WithRSAEncapsulated()
    throws Exception
{
    MimeBodyPart res = generateEncapsulatedRsa(SMIMESignedGenerator.DIGEST_SHA1, msg);
    SMIMESigned  s = new SMIMESigned(res);

    verifyMessageBytes(msg, s.getContent());

    verifySigners(s.getCertificatesAndCRLs("Collection", "BC"), s.getSignerInfos());
}
 
开发者ID:mlundblad,项目名称:bc-java,代码行数:11,代码来源:SMIMESignedTest.java


示例18: testEmbeddedMulti

import org.bouncycastle.mail.smime.SMIMESigned; //导入依赖的package包/类
public void testEmbeddedMulti()
    throws Exception
{
    MimeMessage message = loadMessage("embeddedmulti.message");

    SMIMESigned s = new SMIMESigned((MimeMultipart)message.getContent());

    verifySigners(s.getCertificatesAndCRLs("Collection", "BC"), s.getSignerInfos());
}
 
开发者ID:mlundblad,项目名称:bc-java,代码行数:10,代码来源:SMIMESignedTest.java


示例19: testRIPEMD160WithRSA

import org.bouncycastle.mail.smime.SMIMESigned; //导入依赖的package包/类
public void testRIPEMD160WithRSA()
    throws Exception
{
    MimeMultipart smm = generateMultiPartRsa(SMIMESignedGenerator.DIGEST_RIPEMD160, msg, SMIMESignedGenerator.RFC3851_MICALGS);
    SMIMESigned   s = new  SMIMESigned(smm);

    assertEquals("unknown", getMicAlg(smm));
    assertEquals(getDigestOid(s.getSignerInfos()), TeleTrusTObjectIdentifiers.ripemd160.toString());

    verifyMessageBytes(msg, s.getContent());

    verifySigners(s.getCertificatesAndCRLs("Collection", "BC"), s.getSignerInfos());
}
 
开发者ID:mlundblad,项目名称:bc-java,代码行数:14,代码来源:SMIMESignedTest.java


示例20: testQuotable

import org.bouncycastle.mail.smime.SMIMESigned; //导入依赖的package包/类
public void testQuotable()
    throws Exception
{
    MimeMessage message = loadMessage("quotable.message");
    
    SMIMESigned s = new SMIMESigned((MimeMultipart)message.getContent());
    
    verifySigners(s.getCertificates(), s.getSignerInfos());
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:10,代码来源:NewSMIMESignedTest.java



注:本文中的org.bouncycastle.mail.smime.SMIMESigned类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AssociationSessionType类代码示例发布时间:2022-05-22
下一篇:
Java AuthToken类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap