当前位置: 首页>>代码示例>>Java>>正文


Java BERSet类代码示例

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


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

示例1: SignedData

import org.bouncycastle.asn1.BERSet; //导入依赖的package包/类
public SignedData(
    ASN1Set     digestAlgorithms,
    ContentInfo contentInfo,
    ASN1Set     certificates,
    ASN1Set     crls,
    ASN1Set     signerInfos)
{
    this.version = calculateVersion(contentInfo.getContentType(), certificates, crls, signerInfos);
    this.digestAlgorithms = digestAlgorithms;
    this.contentInfo = contentInfo;
    this.certificates = certificates;
    this.crls = crls;
    this.signerInfos = signerInfos;
    this.crlsBer = crls instanceof BERSet;
    this.certsBer = certificates instanceof BERSet;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:17,代码来源:SignedData.java

示例2: close

import org.bouncycastle.asn1.BERSet; //导入依赖的package包/类
public void close()
    throws IOException
{
    _out.close();
    _eiGen.close();

    if (unprotectedAttributeGenerator != null)
    {
        AttributeTable attrTable = unprotectedAttributeGenerator.getAttributes(new HashMap());
      
        ASN1Set unprotectedAttrs = new BERSet(attrTable.toASN1EncodableVector());

        _envGen.addObject(new DERTaggedObject(false, 1, unprotectedAttrs));
    }
    
    _envGen.close();
    _cGen.close();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:19,代码来源:CMSEnvelopedDataStreamGenerator.java

示例3: createBerSetFromList

import org.bouncycastle.asn1.BERSet; //导入依赖的package包/类
static ASN1Set createBerSetFromList(List derObjects)
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    for (Iterator it = derObjects.iterator(); it.hasNext();)
    {
        v.add((ASN1Encodable)it.next());
    }

    return new BERSet(v);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:12,代码来源:CMSUtils.java

示例4: createBerSetFromList

import org.bouncycastle.asn1.BERSet; //导入依赖的package包/类
/**
 * Gera em formato BER ASN.1
 * @param derObjects -> lista sem tipo definido
 * @return ASN1Set
 * @see org.bouncycastle.asn1.ASN1Set 
 */
static ASN1Set createBerSetFromList(List<?> derObjects)
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    for (Iterator<?> it = derObjects.iterator(); it.hasNext();)
    {
        v.add((DEREncodable)it.next());
    }

    return new BERSet(v);
}
 
开发者ID:esaito,项目名称:ExemplosDemoiselle,代码行数:18,代码来源:CMSUtils.java

示例5: open

import org.bouncycastle.asn1.BERSet; //导入依赖的package包/类
protected OutputStream open(
    ASN1ObjectIdentifier dataType,
    OutputStream         out,
    ASN1EncodableVector  recipientInfos,
    OutputEncryptor      encryptor)
    throws IOException
{
    //
    // ContentInfo
    //
    BERSequenceGenerator cGen = new BERSequenceGenerator(out);

    cGen.addObject(CMSObjectIdentifiers.envelopedData);

    //
    // Encrypted Data
    //
    BERSequenceGenerator envGen = new BERSequenceGenerator(cGen.getRawOutputStream(), 0, true);

    envGen.addObject(getVersion());

    if (originatorInfo != null)
    {
        envGen.addObject(new DERTaggedObject(false, 0, originatorInfo));
    }

    if (_berEncodeRecipientSet)
    {
        envGen.getRawOutputStream().write(new BERSet(recipientInfos).getEncoded());
    }
    else
    {
        envGen.getRawOutputStream().write(new DERSet(recipientInfos).getEncoded());
    }

    BERSequenceGenerator eiGen = new BERSequenceGenerator(envGen.getRawOutputStream());

    eiGen.addObject(dataType);

    AlgorithmIdentifier encAlgId = encryptor.getAlgorithmIdentifier();

    eiGen.getRawOutputStream().write(encAlgId.getEncoded());

    OutputStream octetStream = CMSUtils.createBEROctetOutputStream(
        eiGen.getRawOutputStream(), 0, false, _bufferSize);

    OutputStream cOut = encryptor.getOutputStream(octetStream);

    return new CmsEnvelopedDataOutputStream(cOut, cGen, envGen, eiGen);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:51,代码来源:CMSEnvelopedDataStreamGenerator.java

示例6: close

import org.bouncycastle.asn1.BERSet; //导入依赖的package包/类
public void close()
    throws IOException
{
    dataStream.close();
    eiGen.close();

    Map parameters;

    if (digestCalculator != null)
    {
        parameters = Collections.unmodifiableMap(getBaseParameters(contentType, digestCalculator.getAlgorithmIdentifier(), digestCalculator.getDigest()));

        if (authGen == null)
        {
            authGen = new DefaultAuthenticatedAttributeTableGenerator();
        }
        
        ASN1Set authed = new DERSet(authGen.getAttributes(parameters).toASN1EncodableVector());

        OutputStream mOut = macCalculator.getOutputStream();

        mOut.write(authed.getEncoded(ASN1Encoding.DER));

        mOut.close();

        envGen.addObject(new DERTaggedObject(false, 2, authed));
    }
    else
    {
        parameters = Collections.unmodifiableMap(new HashMap());                
    }

    envGen.addObject(new DEROctetString(macCalculator.getMac()));

    if (unauthGen != null)
    {
        envGen.addObject(new DERTaggedObject(false, 3, new BERSet(unauthGen.getAttributes(parameters).toASN1EncodableVector())));
    }

    envGen.close();
    cGen.close();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:43,代码来源:CMSAuthenticatedDataStreamGenerator.java

示例7: close

import org.bouncycastle.asn1.BERSet; //导入依赖的package包/类
public void close()
    throws IOException
{
    dataStream.close();
    eiGen.close();

    Map parameters;

    if (digestCalculator != null)
    {
        parameters = Collections.unmodifiableMap(getBaseParameters(contentType, digestCalculator.getAlgorithmIdentifier(), macCalculator.getAlgorithmIdentifier(), digestCalculator.getDigest()));

        if (authGen == null)
        {
            authGen = new DefaultAuthenticatedAttributeTableGenerator();
        }
        
        ASN1Set authed = new DERSet(authGen.getAttributes(parameters).toASN1EncodableVector());

        OutputStream mOut = macCalculator.getOutputStream();

        mOut.write(authed.getEncoded(ASN1Encoding.DER));

        mOut.close();

        envGen.addObject(new DERTaggedObject(false, 2, authed));
    }
    else
    {
        parameters = Collections.unmodifiableMap(new HashMap());                
    }

    envGen.addObject(new DEROctetString(macCalculator.getMac()));

    if (unauthGen != null)
    {
        envGen.addObject(new DERTaggedObject(false, 3, new BERSet(unauthGen.getAttributes(parameters).toASN1EncodableVector())));
    }

    envGen.close();
    cGen.close();
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:43,代码来源:CMSAuthenticatedDataStreamGenerator.java

示例8: close

import org.bouncycastle.asn1.BERSet; //导入依赖的package包/类
public void close()
    throws IOException
{
    dataStream.close();
    eiGen.close();

    Map parameters;

    if (digestCalculator != null)
    {
        parameters = getBaseParameters(contentType, digestCalculator.getAlgorithmIdentifier(), digestCalculator.getDigest());

        if (authGen == null)
        {
            authGen = new DefaultAuthenticatedAttributeTableGenerator();
        }
        
        ASN1Set authed = new DERSet(authGen.getAttributes(parameters).toASN1EncodableVector());

        OutputStream mOut = macCalculator.getOutputStream();

        mOut.write(authed.getEncoded(ASN1Encoding.DER));

        mOut.close();

        envGen.addObject(new DERTaggedObject(false, 2, authed));
    }
    else
    {
        parameters = new HashMap();                
    }

    envGen.addObject(new DEROctetString(macCalculator.getMac()));

    if (unauthGen != null)
    {
        envGen.addObject(new DERTaggedObject(false, 3, new BERSet(unauthGen.getAttributes(parameters).toASN1EncodableVector())));
    }

    envGen.close();
    cGen.close();
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:43,代码来源:CMSAuthenticatedDataStreamGenerator.java

示例9: perform

import org.bouncycastle.asn1.BERSet; //导入依赖的package包/类
public TestResult perform()
{
    byte[]    data = { 0, 1, 0, 1, 0, 0, 1 };
    
    ASN1Primitive    values[] = {
            new BERConstructedOctetString(data),
            new BERSequence(new DERPrintableString("hello world")),
            new BERSet(new DERPrintableString("hello world")),
            new BERTaggedObject(0, new DERPrintableString("hello world")),
            new DERApplicationSpecific(0, data),
            new DERBitString(data),
            new DERBMPString("hello world"),
            new DERBoolean(true),
            new DERBoolean(false),
            new DEREnumerated(100),
            new DERGeneralizedTime("20070315173729Z"),
            new DERGeneralString("hello world"),
            new DERIA5String("hello"),
            new DERInteger(1000),
            new DERNull(),
            new DERNumericString("123456"),
            new DERObjectIdentifier("1.1.1.10000.1"),
            new DEROctetString(data),
            new DERPrintableString("hello world"),
            new DERSequence(new DERPrintableString("hello world")),
            new DERSet(new DERPrintableString("hello world")),
            new DERT61String("hello world"),
            new DERTaggedObject(0, new DERPrintableString("hello world")),
            new DERUniversalString(data),
            new DERUTCTime(new Date()),
            new DERUTF8String("hello world"),
            new DERVisibleString("hello world")
        };
    
    try
    {
        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);
        
        for (int i = 0; i != values.length; i++)
        {
            aOut.writeObject(values[i]);
        }
        
        ASN1Primitive[] readValues = new ASN1Primitive[values.length];
        
        ByteArrayInputStream    bIn = new ByteArrayInputStream(bOut.toByteArray());
        ASN1InputStream         aIn = new ASN1InputStream(bIn);
        
        for (int i = 0; i != values.length; i++)
        {
            ASN1Primitive o = aIn.readObject();
            if (!o.equals(values[i]))
            {
                return new SimpleTestResult(false, getName() + ": Failed equality test for " + o.getClass());
            }
            
            if (o.hashCode() != values[i].hashCode())
            {
                return new SimpleTestResult(false, getName() + ": Failed hashCode test for " + o.getClass());
            }
        }
    }
    catch (Exception e)
    {
        return new SimpleTestResult(false, getName() + ": Failed - exception " + e.toString(), e);
    }
    
    return new SimpleTestResult(true, getName() + ": Okay");
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:71,代码来源:EqualsAndHashCodeTest.java


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