⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 encrypteddata.java

📁 kmlnjlkj nlkjlkjkljl okopokipoipo oipipipo i
💻 JAVA
字号:
package org.bouncycastle.asn1.cms;import org.bouncycastle.asn1.ASN1Encodable;import org.bouncycastle.asn1.ASN1EncodableVector;import org.bouncycastle.asn1.ASN1Sequence;import org.bouncycastle.asn1.ASN1Set;import org.bouncycastle.asn1.BERSequence;import org.bouncycastle.asn1.BERTaggedObject;import org.bouncycastle.asn1.DERInteger;import org.bouncycastle.asn1.DERObject;public class EncryptedData    extends ASN1Encodable{    private DERInteger version;    private EncryptedContentInfo encryptedContentInfo;    private ASN1Set unprotectedAttrs;    public static EncryptedData getInstance(Object o)    {        if (o instanceof EncryptedData)        {            return (EncryptedData)o;        }        if (o instanceof ASN1Sequence)        {            return new EncryptedData((ASN1Sequence)o);        }        throw new IllegalArgumentException("Invalid EncryptedData: " + o.getClass().getName());    }    public EncryptedData(EncryptedContentInfo encInfo)    {        this(encInfo,  null);    }    public EncryptedData(EncryptedContentInfo encInfo, ASN1Set unprotectedAttrs)    {        this.version = new DERInteger((unprotectedAttrs == null) ? 0 : 2);        this.encryptedContentInfo = encInfo;        this.unprotectedAttrs = unprotectedAttrs;    }    private EncryptedData(ASN1Sequence seq)    {        this.version = DERInteger.getInstance(seq.getObjectAt(0));        this.encryptedContentInfo = EncryptedContentInfo.getInstance(seq.getObjectAt(1));        if (seq.size() == 3)        {            this.unprotectedAttrs = ASN1Set.getInstance(seq.getObjectAt(2));        }    }    public DERInteger getVersion()    {        return version;    }    public EncryptedContentInfo getEncryptedContentInfo()    {        return encryptedContentInfo;    }    public ASN1Set getUnprotectedAttrs()    {        return unprotectedAttrs;    }    /**     * <pre>     *       EncryptedData ::= SEQUENCE {     *                     version CMSVersion,     *                     encryptedContentInfo EncryptedContentInfo,     *                     unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }     * </pre>     * @return a basic ASN.1 object representation.     */    public DERObject toASN1Object()    {        ASN1EncodableVector v = new ASN1EncodableVector();        v.add(version);        v.add(encryptedContentInfo);        if (unprotectedAttrs != null)        {            v.add(new BERTaggedObject(false, 1, unprotectedAttrs));        }        return new BERSequence(v);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -