View Javadoc
1 /* 2 * Title: S/MIME Project 3 * Description: S/MIME email sending capabilities 4 * @Author Vladimir Radisic 5 * @Version 2.0.1 6 */ 7 8 9 package org.webdocwf.util.smime.cms; 10 11 12 import org.webdocwf.util.smime.exception.SMIMEException; 13 import org.webdocwf.util.smime.der.DERSequencePr; 14 15 16 /*** 17 * EnvelopedData is DER encoded container for information represented in 18 * ASN.1 notation according to RFC2630, used for construction CMS object 19 * of encrypted message.<BR> 20 * <BR> 21 * <DL> 22 * EnvelopedData ::= SEQUENCE {<BR> 23 * <DD> version CMSVersion,<BR> 24 * <DD> originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,<BR> 25 * <DD> recipientInfos RecipientInfos,<BR> 26 * <DD> encryptedContentInfo EncryptedContentInfo,<BR> 27 * <DD> unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }<BR> 28 * </DL> 29 */ 30 public class EnvelopedData extends DERSequencePr { 31 32 /*** 33 * Determinate order of adding commponents 34 */ 35 int orderIdentifier = 0; 36 37 /*** 38 * Constructs empty Enveloped Data. 39 * @exception SMIMEException thrown from super class constructor. 40 */ 41 public EnvelopedData() throws SMIMEException {} 42 43 /*** 44 * Adds CMS Version. 45 * @param ver0 CMS version represented as byte array 46 * @exception SMIMEException if order of adding components is wrong. Also, it 47 * can be thrown from super class addContent method. 48 */ 49 public void addCMSVersion(byte[] ver0) throws SMIMEException { 50 if (orderIdentifier == 0) { 51 super.addContent(ver0); 52 orderIdentifier++; 53 orderIdentifier++; 54 } else 55 throw new SMIMEException(this, 1018); 56 } 57 58 /*** 59 * Adds Recipient Infos. 60 * @param info0 Recipient Infos represented as byte array 61 * @exception SMIMEException if order of adding components is wrong. Also, it 62 * can be thrown from super class addContent method. 63 */ 64 public void addRecipientInfos(byte[] info0) throws SMIMEException { 65 if (orderIdentifier == 2) { 66 super.addContent(info0); 67 orderIdentifier++; 68 } else 69 throw new SMIMEException(this, 1018); 70 } 71 72 /*** 73 * Adds Encrypt Content Info. 74 * @param info0 Encrypt Content Info represented as byte array 75 * @exception SMIMEException if order of adding components is wrong. Also, it 76 * can be thrown from super class addContent method. 77 */ 78 public void addEncryptContentInfo(byte[] info0) throws SMIMEException { 79 if (orderIdentifier == 3) { 80 super.addContent(info0); 81 orderIdentifier++; 82 } else 83 throw new SMIMEException(this, 1018); 84 } 85 } 86

This page was automatically generated by Maven