Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
RecipientInfo.java
Package: security.rar [view]
Upload User: lior1029
Upload Date: 2013-05-07
Package Size: 209k
Code Size: 3k
Category:
CA program
Development Platform:
Java
- package org.bouncycastle.asn1.cms;
- import org.bouncycastle.asn1.ASN1Sequence;
- import org.bouncycastle.asn1.ASN1TaggedObject;
- import org.bouncycastle.asn1.DERTaggedObject;
- import org.bouncycastle.asn1.DEREncodable;
- import org.bouncycastle.asn1.DERInteger;
- import org.bouncycastle.asn1.DERObject;
- public class RecipientInfo
- implements DEREncodable
- {
- DEREncodable info;
- public RecipientInfo(
- KeyTransRecipientInfo info)
- {
- this.info = info;
- }
- public RecipientInfo(
- KeyAgreeRecipientInfo info)
- {
- this.info = new DERTaggedObject(true, 1, info);
- }
- public RecipientInfo(
- KEKRecipientInfo info)
- {
- this.info = new DERTaggedObject(true, 2, info);
- }
- public RecipientInfo(
- DERObject info)
- {
- this.info = info;
- }
- public static RecipientInfo getInstance(
- Object o)
- {
- if (o == null || o instanceof RecipientInfo)
- {
- return (RecipientInfo)o;
- }
- else if (o instanceof ASN1Sequence)
- {
- return new RecipientInfo((ASN1Sequence)o);
- }
- else if (o instanceof ASN1TaggedObject)
- {
- return new RecipientInfo((ASN1TaggedObject)o);
- }
- throw new IllegalArgumentException("unknown object in factory: "
- + o.getClass().getName());
- }
- public DERInteger getVersion()
- {
- if (info instanceof ASN1TaggedObject)
- {
- ASN1TaggedObject o = (ASN1TaggedObject)info;
- switch (o.getTagNo())
- {
- case 1:
- return KeyAgreeRecipientInfo.getInstance(o, true).getVersion();
- case 2:
- return KEKRecipientInfo.getInstance(o, true).getVersion();
- default:
- throw new IllegalStateException("unknown tag");
- }
- }
- return KeyTransRecipientInfo.getInstance(info).getVersion();
- }
- public boolean isTagged()
- {
- return (info instanceof ASN1TaggedObject);
- }
- public DEREncodable getInfo()
- {
- if (info instanceof ASN1TaggedObject)
- {
- ASN1TaggedObject o = (ASN1TaggedObject)info;
- switch (o.getTagNo())
- {
- case 1:
- return KeyAgreeRecipientInfo.getInstance(o, true);
- case 2:
- return KEKRecipientInfo.getInstance(o, true);
- default:
- throw new IllegalStateException("unknown tag");
- }
- }
- return KeyTransRecipientInfo.getInstance(info);
- }
- /**
- * <pre>
- * RecipientInfo ::= CHOICE {
- * ktri KeyTransRecipientInfo,
- * kari [1] KeyAgreeRecipientInfo,
- * kekri [2] KEKRecipientInfo
- * }
- * </pre>
- */
- public DERObject getDERObject()
- {
- return info.getDERObject();
- }
- }