Java 类org.bouncycastle.asn1.cms.EnvelopedData 实例源码

项目:ipack    文件:EncryptedKey.java   
public static EncryptedKey getInstance(Object o)
{
    if (o instanceof EncryptedKey)
    {
        return (EncryptedKey)o;
    }
    else if (o instanceof ASN1TaggedObject)
    {
        return new EncryptedKey(EnvelopedData.getInstance((ASN1TaggedObject)o, false));
    }
    else if (o instanceof EncryptedValue)
    {
        return new EncryptedKey((EncryptedValue)o);
    }
    else
    {
        return new EncryptedKey(EncryptedValue.getInstance(o));
    }
}
项目:ipack    文件:POPOPrivKey.java   
private POPOPrivKey(ASN1TaggedObject obj)
{
    this.tagNo = obj.getTagNo();

    switch (tagNo)
    {
    case thisMessage:
        this.obj = DERBitString.getInstance(obj, false);
        break;
    case subsequentMessage:
        this.obj = SubsequentMessage.valueOf(ASN1Integer.getInstance(obj, false).getValue().intValue());
        break;
    case dhMAC:
        this.obj = DERBitString.getInstance(obj, false);
        break;
    case agreeMAC:
        this.obj = PKMACValue.getInstance(obj, false);
        break;
    case encryptedKey:
        this.obj = EnvelopedData.getInstance(obj, false);
        break;
    default:
        throw new IllegalArgumentException("unknown tag in POPOPrivKey");
    }
}
项目:gwt-crypto    文件:EncryptedKey.java   
public static EncryptedKey getInstance(Object o)
{
    if (o instanceof EncryptedKey)
    {
        return (EncryptedKey)o;
    }
    else if (o instanceof ASN1TaggedObject)
    {
        return new EncryptedKey(EnvelopedData.getInstance((ASN1TaggedObject)o, false));
    }
    else if (o instanceof EncryptedValue)
    {
        return new EncryptedKey((EncryptedValue)o);
    }
    else
    {
        return new EncryptedKey(EncryptedValue.getInstance(o));
    }
}
项目:gwt-crypto    文件:POPOPrivKey.java   
private POPOPrivKey(ASN1TaggedObject obj)
{
    this.tagNo = obj.getTagNo();

    switch (tagNo)
    {
    case thisMessage:
        this.obj = DERBitString.getInstance(obj, false);
        break;
    case subsequentMessage:
        this.obj = SubsequentMessage.valueOf(ASN1Integer.getInstance(obj, false).getValue().intValue());
        break;
    case dhMAC:
        this.obj = DERBitString.getInstance(obj, false);
        break;
    case agreeMAC:
        this.obj = PKMACValue.getInstance(obj, false);
        break;
    case encryptedKey:
        this.obj = EnvelopedData.getInstance(obj, false);
        break;
    default:
        throw new IllegalArgumentException("unknown tag in POPOPrivKey");
    }
}
项目:Aki-SSL    文件:EncryptedKey.java   
public static EncryptedKey getInstance(Object o)
{
    if (o instanceof EncryptedKey)
    {
        return (EncryptedKey)o;
    }
    else if (o instanceof ASN1TaggedObject)
    {
        return new EncryptedKey(EnvelopedData.getInstance((ASN1TaggedObject)o, false));
    }
    else if (o instanceof EncryptedValue)
    {
        return new EncryptedKey((EncryptedValue)o);
    }
    else
    {
        return new EncryptedKey(EncryptedValue.getInstance(o));
    }
}
项目:Aki-SSL    文件:POPOPrivKey.java   
private POPOPrivKey(ASN1TaggedObject obj)
{
    this.tagNo = obj.getTagNo();

    switch (tagNo)
    {
    case thisMessage:
        this.obj = DERBitString.getInstance(obj, false);
        break;
    case subsequentMessage:
        this.obj = SubsequentMessage.valueOf(ASN1Integer.getInstance(obj, false).getValue().intValue());
        break;
    case dhMAC:
        this.obj = DERBitString.getInstance(obj, false);
        break;
    case agreeMAC:
        this.obj = PKMACValue.getInstance(obj, false);
        break;
    case encryptedKey:
        this.obj = EnvelopedData.getInstance(obj, false);
        break;
    default:
        throw new IllegalArgumentException("unknown tag in POPOPrivKey");
    }
}
项目:TinyTravelTracker    文件:EncryptedKey.java   
public static EncryptedKey getInstance(Object o)
{
    if (o instanceof EncryptedKey)
    {
        return (EncryptedKey)o;
    }
    else if (o instanceof ASN1TaggedObject)
    {
        return new EncryptedKey(EnvelopedData.getInstance((ASN1TaggedObject)o, false));
    }
    else if (o instanceof EncryptedValue)
    {
        return new EncryptedKey((EncryptedValue)o);
    }
    else
    {
        return new EncryptedKey(EncryptedValue.getInstance(o));
    }
}
项目:TinyTravelTracker    文件:POPOPrivKey.java   
private POPOPrivKey(ASN1TaggedObject obj)
{
    this.tagNo = obj.getTagNo();

    switch (tagNo)
    {
    case thisMessage:
        this.obj = DERBitString.getInstance(obj, false);
        break;
    case subsequentMessage:
        this.obj = SubsequentMessage.valueOf(ASN1Integer.getInstance(obj, false).getValue().intValue());
        break;
    case dhMAC:
        this.obj = DERBitString.getInstance(obj, false);
        break;
    case agreeMAC:
        this.obj = PKMACValue.getInstance(obj, false);
        break;
    case encryptedKey:
        this.obj = EnvelopedData.getInstance(obj, false);
        break;
    default:
        throw new IllegalArgumentException("unknown tag in POPOPrivKey");
    }
}
项目:CryptMeme    文件:EncryptedKey.java   
public static EncryptedKey getInstance(Object o)
{
    if (o instanceof EncryptedKey)
    {
        return (EncryptedKey)o;
    }
    else if (o instanceof ASN1TaggedObject)
    {
        return new EncryptedKey(EnvelopedData.getInstance((ASN1TaggedObject)o, false));
    }
    else if (o instanceof EncryptedValue)
    {
        return new EncryptedKey((EncryptedValue)o);
    }
    else
    {
        return new EncryptedKey(EncryptedValue.getInstance(o));
    }
}
项目:CryptMeme    文件:POPOPrivKey.java   
private POPOPrivKey(ASN1TaggedObject obj)
{
    this.tagNo = obj.getTagNo();

    switch (tagNo)
    {
    case thisMessage:
        this.obj = DERBitString.getInstance(obj, false);
        break;
    case subsequentMessage:
        this.obj = SubsequentMessage.valueOf(ASN1Integer.getInstance(obj, false).getValue().intValue());
        break;
    case dhMAC:
        this.obj = DERBitString.getInstance(obj, false);
        break;
    case agreeMAC:
        this.obj = PKMACValue.getInstance(obj, false);
        break;
    case encryptedKey:
        this.obj = EnvelopedData.getInstance(obj, false);
        break;
    default:
        throw new IllegalArgumentException("unknown tag in POPOPrivKey");
    }
}
项目:irma_future_id    文件:EncryptedKey.java   
public static EncryptedKey getInstance(Object o)
{
    if (o instanceof EncryptedKey)
    {
        return (EncryptedKey)o;
    }
    else if (o instanceof ASN1TaggedObject)
    {
        return new EncryptedKey(EnvelopedData.getInstance((ASN1TaggedObject)o, false));
    }
    else if (o instanceof EncryptedValue)
    {
        return new EncryptedKey((EncryptedValue)o);
    }
    else
    {
        return new EncryptedKey(EncryptedValue.getInstance(o));
    }
}
项目:irma_future_id    文件:POPOPrivKey.java   
private POPOPrivKey(ASN1TaggedObject obj)
{
    this.tagNo = obj.getTagNo();

    switch (tagNo)
    {
    case thisMessage:
        this.obj = DERBitString.getInstance(obj, false);
        break;
    case subsequentMessage:
        this.obj = SubsequentMessage.valueOf(ASN1Integer.getInstance(obj, false).getValue().intValue());
        break;
    case dhMAC:
        this.obj = DERBitString.getInstance(obj, false);
        break;
    case agreeMAC:
        this.obj = PKMACValue.getInstance(obj, false);
        break;
    case encryptedKey:
        this.obj = EnvelopedData.getInstance(obj, false);
        break;
    default:
        throw new IllegalArgumentException("unknown tag in POPOPrivKey");
    }
}
项目:bc-java    文件:EncryptedKey.java   
public static EncryptedKey getInstance(Object o)
{
    if (o instanceof EncryptedKey)
    {
        return (EncryptedKey)o;
    }
    else if (o instanceof ASN1TaggedObject)
    {
        return new EncryptedKey(EnvelopedData.getInstance((ASN1TaggedObject)o, false));
    }
    else if (o instanceof EncryptedValue)
    {
        return new EncryptedKey((EncryptedValue)o);
    }
    else
    {
        return new EncryptedKey(EncryptedValue.getInstance(o));
    }
}
项目:bc-java    文件:POPOPrivKey.java   
private POPOPrivKey(ASN1TaggedObject obj)
{
    this.tagNo = obj.getTagNo();

    switch (tagNo)
    {
    case thisMessage:
        this.obj = DERBitString.getInstance(obj, false);
        break;
    case subsequentMessage:
        this.obj = SubsequentMessage.valueOf(ASN1Integer.getInstance(obj, false).getValue().intValue());
        break;
    case dhMAC:
        this.obj = DERBitString.getInstance(obj, false);
        break;
    case agreeMAC:
        this.obj = PKMACValue.getInstance(obj, false);
        break;
    case encryptedKey:
        this.obj = EnvelopedData.getInstance(obj, false);
        break;
    default:
        throw new IllegalArgumentException("unknown tag in POPOPrivKey");
    }
}
项目:ipack    文件:PKIArchiveControlBuilder.java   
/**
 * Build the PKIArchiveControl using the passed in encryptor to encrypt its contents.
 *
 * @param contentEncryptor a suitable content encryptor.
 * @return a PKIArchiveControl object.
 * @throws CMSException in the event the build fails.
 */
public PKIArchiveControl build(OutputEncryptor contentEncryptor)
    throws CMSException
{
    CMSEnvelopedData envContent = envGen.generate(keyContent, contentEncryptor);

    EnvelopedData envD = EnvelopedData.getInstance(envContent.toASN1Structure().getContent());

    return new PKIArchiveControl(new PKIArchiveOptions(new EncryptedKey(envD)));
}
项目:itext2    文件:PdfPublicKeySecurityHandler.java   
private ASN1Primitive createDERForRecipient(byte[] in, X509Certificate cert) 
    throws IOException,  
           GeneralSecurityException 
{

    String s = "1.2.840.113549.3.2";

    AlgorithmParameterGenerator algorithmparametergenerator = AlgorithmParameterGenerator.getInstance(s);
    AlgorithmParameters algorithmparameters = algorithmparametergenerator.generateParameters();
    ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(algorithmparameters.getEncoded("ASN.1"));
    ASN1InputStream asn1inputstream = new ASN1InputStream(bytearrayinputstream);
    ASN1Primitive derobject = asn1inputstream.readObject();
    KeyGenerator keygenerator = KeyGenerator.getInstance(s);
    keygenerator.init(128);
    SecretKey secretkey = keygenerator.generateKey();
    Cipher cipher = Cipher.getInstance(s);
    cipher.init(1, secretkey, algorithmparameters);
    byte[] abyte1 = cipher.doFinal(in);
    DEROctetString deroctetstring = new DEROctetString(abyte1);
    KeyTransRecipientInfo keytransrecipientinfo = computeRecipientInfo(cert, secretkey.getEncoded());
    DERSet derset = new DERSet(new RecipientInfo(keytransrecipientinfo));
    AlgorithmIdentifier algorithmidentifier = new AlgorithmIdentifier(new ASN1ObjectIdentifier(s), derobject);
    EncryptedContentInfo encryptedcontentinfo = 
        new EncryptedContentInfo(PKCSObjectIdentifiers.data, algorithmidentifier, deroctetstring);
    EnvelopedData env = new EnvelopedData(null, derset, encryptedcontentinfo, (org.bouncycastle.asn1.ASN1Set) null);
    ContentInfo contentinfo = 
        new ContentInfo(PKCSObjectIdentifiers.envelopedData, env);
    return contentinfo.toASN1Primitive();        
}
项目:gwt-crypto    文件:PKIArchiveControlBuilder.java   
/**
 * Build the PKIArchiveControl using the passed in encryptor to encrypt its contents.
 *
 * @param contentEncryptor a suitable content encryptor.
 * @return a PKIArchiveControl object.
 * @throws CMSException in the event the build fails.
 */
public PKIArchiveControl build(OutputEncryptor contentEncryptor)
    throws CMSException
{
    CMSEnvelopedData envContent = envGen.generate(keyContent, contentEncryptor);

    EnvelopedData envD = EnvelopedData.getInstance(envContent.toASN1Structure().getContent());

    return new PKIArchiveControl(new PKIArchiveOptions(new EncryptedKey(envD)));
}
项目:Aki-SSL    文件:PKIArchiveControlBuilder.java   
/**
 * Build the PKIArchiveControl using the passed in encryptor to encrypt its contents.
 *
 * @param contentEncryptor a suitable content encryptor.
 * @return a PKIArchiveControl object.
 * @throws CMSException in the event the build fails.
 */
public PKIArchiveControl build(OutputEncryptor contentEncryptor)
    throws CMSException
{
    CMSEnvelopedData envContent = envGen.generate(keyContent, contentEncryptor);

    EnvelopedData envD = EnvelopedData.getInstance(envContent.toASN1Structure().getContent());

    return new PKIArchiveControl(new PKIArchiveOptions(new EncryptedKey(envD)));
}
项目:irma_future_id    文件:PKIArchiveControlBuilder.java   
/**
 * Build the PKIArchiveControl using the passed in encryptor to encrypt its contents.
 *
 * @param contentEncryptor a suitable content encryptor.
 * @return a PKIArchiveControl object.
 * @throws CMSException in the event the build fails.
 */
public PKIArchiveControl build(OutputEncryptor contentEncryptor)
    throws CMSException
{
    CMSEnvelopedData envContent = envGen.generate(keyContent, contentEncryptor);

    EnvelopedData envD = EnvelopedData.getInstance(envContent.toASN1Structure().getContent());

    return new PKIArchiveControl(new PKIArchiveOptions(new EncryptedKey(envD)));
}
项目:bc-java    文件:PKIArchiveControlBuilder.java   
/**
 * Build the PKIArchiveControl using the passed in encryptor to encrypt its contents.
 *
 * @param contentEncryptor a suitable content encryptor.
 * @return a PKIArchiveControl object.
 * @throws CMSException in the event the build fails.
 */
public PKIArchiveControl build(OutputEncryptor contentEncryptor)
    throws CMSException
{
    CMSEnvelopedData envContent = envGen.generate(keyContent, contentEncryptor);

    EnvelopedData envD = EnvelopedData.getInstance(envContent.toASN1Structure().getContent());

    return new PKIArchiveControl(new PKIArchiveOptions(new EncryptedKey(envD)));
}
项目:ipack    文件:EncryptedKey.java   
public EncryptedKey(EnvelopedData envelopedData)
{
    this.envelopedData = envelopedData;
}
项目:gwt-crypto    文件:EncryptedKey.java   
public EncryptedKey(EnvelopedData envelopedData)
{
    this.envelopedData = envelopedData;
}
项目:Aki-SSL    文件:EncryptedKey.java   
public EncryptedKey(EnvelopedData envelopedData)
{
    this.envelopedData = envelopedData;
}
项目:TinyTravelTracker    文件:EncryptedKey.java   
public EncryptedKey(EnvelopedData envelopedData)
{
    this.envelopedData = envelopedData;
}
项目:CryptMeme    文件:EncryptedKey.java   
public EncryptedKey(EnvelopedData envelopedData)
{
    this.envelopedData = envelopedData;
}
项目:irma_future_id    文件:EncryptedKey.java   
public EncryptedKey(EnvelopedData envelopedData)
{
    this.envelopedData = envelopedData;
}
项目:bc-java    文件:EncryptedKey.java   
public EncryptedKey(EnvelopedData envelopedData)
{
    this.envelopedData = envelopedData;
}