當前位置: 首頁>>代碼示例>>Java>>正文


Java FileBackedMimeBodyPart.dispose方法代碼示例

本文整理匯總了Java中org.bouncycastle.mail.smime.util.FileBackedMimeBodyPart.dispose方法的典型用法代碼示例。如果您正苦於以下問題:Java FileBackedMimeBodyPart.dispose方法的具體用法?Java FileBackedMimeBodyPart.dispose怎麽用?Java FileBackedMimeBodyPart.dispose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bouncycastle.mail.smime.util.FileBackedMimeBodyPart的用法示例。


在下文中一共展示了FileBackedMimeBodyPart.dispose方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testSHA1WithRSAEncapsulatedParserAndFile

import org.bouncycastle.mail.smime.util.FileBackedMimeBodyPart; //導入方法依賴的package包/類
public void testSHA1WithRSAEncapsulatedParserAndFile()
    throws Exception
{
    File         tmp = File.createTempFile("bcTest", ".mime");
    MimeBodyPart res = generateEncapsulatedRsa("SHA1withRSA", msg);       
    SMIMESignedParser s = new SMIMESignedParser(new JcaDigestCalculatorProviderBuilder().setProvider(BC).build(), res, tmp);
    FileBackedMimeBodyPart content = (FileBackedMimeBodyPart)s.getContent();

    verifyMessageBytes(msg, s.getContent());

    verifySigners(s.getCertificates(), s.getSignerInfos());
    
    assertTrue(tmp.exists());
    
    s.close();
    
    content.dispose();
    
    assertFalse(tmp.exists());
}
 
開發者ID:credentials,項目名稱:irma_future_id,代碼行數:21,代碼來源:NewSMIMESignedTest.java

示例2: testSHA1WithRSAEncapsulatedParserAndFile

import org.bouncycastle.mail.smime.util.FileBackedMimeBodyPart; //導入方法依賴的package包/類
public void testSHA1WithRSAEncapsulatedParserAndFile()
    throws Exception
{
    File         tmp = File.createTempFile("bcTest", ".mime");
    MimeBodyPart res = generateEncapsulatedRsa(SMIMESignedGenerator.DIGEST_SHA1, msg);       
    SMIMESignedParser s = new SMIMESignedParser(res, tmp);
    FileBackedMimeBodyPart content = (FileBackedMimeBodyPart)s.getContent();

    verifyMessageBytes(msg, s.getContent());

    verifySigners(s.getCertificatesAndCRLs("Collection", "BC"), s.getSignerInfos());
    
    assertTrue(tmp.exists());
    
    s.close();
    
    content.dispose();
    
    assertFalse(tmp.exists());
}
 
開發者ID:credentials,項目名稱:irma_future_id,代碼行數:21,代碼來源:SMIMESignedTest.java

示例3: testSHA1WithRSAEncapsulatedParser

import org.bouncycastle.mail.smime.util.FileBackedMimeBodyPart; //導入方法依賴的package包/類
public void testSHA1WithRSAEncapsulatedParser()
    throws Exception
{
    MimeBodyPart res = generateEncapsulatedRsa("SHA1withRSA", msg);
    SMIMESignedParser s = new SMIMESignedParser(new JcaDigestCalculatorProviderBuilder().setProvider(BC).build(), res);

    FileBackedMimeBodyPart content = (FileBackedMimeBodyPart)s.getContent();
    
    verifyMessageBytes(msg, content);

    content.dispose();
    
    verifySigners(s.getCertificates(), s.getSignerInfos());
    
    s.close();
}
 
開發者ID:credentials,項目名稱:irma_future_id,代碼行數:17,代碼來源:NewSMIMESignedTest.java

示例4: testSHA1WithRSAEncapsulatedParser

import org.bouncycastle.mail.smime.util.FileBackedMimeBodyPart; //導入方法依賴的package包/類
public void testSHA1WithRSAEncapsulatedParser()
    throws Exception
{
    MimeBodyPart res = generateEncapsulatedRsa(SMIMESignedGenerator.DIGEST_SHA1, msg);       
    SMIMESignedParser s = new SMIMESignedParser(res);

    FileBackedMimeBodyPart content = (FileBackedMimeBodyPart)s.getContent();
    
    verifyMessageBytes(msg, content);

    content.dispose();
    
    verifySigners(s.getCertificatesAndCRLs("Collection", "BC"), s.getSignerInfos());
    
    s.close();
}
 
開發者ID:credentials,項目名稱:irma_future_id,代碼行數:17,代碼來源:SMIMESignedTest.java

示例5: testTwoRecipients

import org.bouncycastle.mail.smime.util.FileBackedMimeBodyPart; //導入方法依賴的package包/類
public void testTwoRecipients()
    throws Exception
{
    MimeBodyPart    _msg      = SMIMETestUtil.makeMimeBodyPart("WallaWallaWashington");

    SMIMEEnvelopedGenerator   gen = new SMIMEEnvelopedGenerator();
      
    gen.addKeyTransRecipient(_reciCert);
    gen.addKeyTransRecipient(_reciCert2);
     
    //
    // generate a MimeBodyPart object which encapsulates the content
    // we want encrypted.
    //
    MimeBodyPart mp = gen.generate(_msg, SMIMEEnvelopedGenerator.RC2_CBC, 40, "BC");

    SMIMEEnvelopedParser       m = new SMIMEEnvelopedParser(mp);

    RecipientId                recId = getRecipientId(_reciCert2);

    RecipientInformationStore  recipients = m.getRecipientInfos();
    RecipientInformation       recipient = recipients.get(recId);
    
    FileBackedMimeBodyPart    res = SMIMEUtil.toMimeBodyPart(recipient.getContentStream(_reciKP2.getPrivate(), "BC"));

    verifyMessageBytes(_msg, res);
    
    m = new SMIMEEnvelopedParser(mp);

    res.dispose();
    
    recId = getRecipientId(_reciCert);

    recipients = m.getRecipientInfos();
    recipient = recipients.get(recId);
 
    res = SMIMEUtil.toMimeBodyPart(recipient.getContentStream(_reciKP.getPrivate(), "BC"));

    verifyMessageBytes(_msg, res);
    
    res.dispose();
}
 
開發者ID:credentials,項目名稱:irma_future_id,代碼行數:43,代碼來源:SMIMEEnvelopedTest.java

示例6: testTwoRecipients

import org.bouncycastle.mail.smime.util.FileBackedMimeBodyPart; //導入方法依賴的package包/類
public void testTwoRecipients()
    throws Exception
{
    MimeBodyPart    _msg      = SMIMETestUtil.makeMimeBodyPart("WallaWallaWashington");

    SMIMEEnvelopedGenerator   gen = new SMIMEEnvelopedGenerator();

    gen.addRecipientInfoGenerator(new JceKeyTransRecipientInfoGenerator(_reciCert).setProvider(BC));
    gen.addRecipientInfoGenerator(new JceKeyTransRecipientInfoGenerator(_reciCert2).setProvider(BC));
     
    //
    // generate a MimeBodyPart object which encapsulates the content
    // we want encrypted.
    //
    MimeBodyPart mp = gen.generate(_msg, new JceCMSContentEncryptorBuilder(CMSAlgorithm.RC2_CBC, 40).setProvider(BC).build());

    SMIMEEnvelopedParser       m = new SMIMEEnvelopedParser(mp);

    RecipientId                recId = getRecipientId(_reciCert2);

    RecipientInformationStore  recipients = m.getRecipientInfos();
    RecipientInformation       recipient = recipients.get(recId);
    
    FileBackedMimeBodyPart    res = SMIMEUtil.toMimeBodyPart(recipient.getContentStream(new JceKeyTransEnvelopedRecipient(_reciKP2.getPrivate()).setProvider(BC)));

    verifyMessageBytes(_msg, res);
    
    m = new SMIMEEnvelopedParser(mp);

    res.dispose();
    
    recId = getRecipientId(_reciCert);

    recipients = m.getRecipientInfos();
    recipient = recipients.get(recId);
 
    res = SMIMEUtil.toMimeBodyPart(recipient.getContentStream(new JceKeyTransEnvelopedRecipient(_reciKP.getPrivate()).setProvider(BC)));

    verifyMessageBytes(_msg, res);
    
    res.dispose();
}
 
開發者ID:credentials,項目名稱:irma_future_id,代碼行數:43,代碼來源:NewSMIMEEnvelopedTest.java


注:本文中的org.bouncycastle.mail.smime.util.FileBackedMimeBodyPart.dispose方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。