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 import org.webdocwf.util.smime.der.DERObjectIdentifier; 15 import org.webdocwf.util.smime.der.DERNull; 16 17 18 /*** 19 * AlgorithmIdentifier class is DER encoded Algorithm identifier represented in ASN.1 20 * notation according to RFC2630.<BR> 21 * <BR> 22 * <DL> 23 * AlgorithmIdentifier ::= SEQUENCE {<BR> 24 * <DD> algorithm AlgorithmIdentifier,<BR> 25 * <DD> parameters ANY DEFINED BY algorithm OPTIONAL }<BR> 26 * </DL> 27 * <BR> 28 * AlgorithmIdentifier ::= OBJECT IDENTIFIER<BR> 29 */ 30 public class AlgorithmIdentifier extends DERSequencePr { 31 32 /*** 33 * This constructor has two different forms, depend on parameter typeConstruction0, 34 * which can be: DOT_SEPARATED_ARRAY or NAME_STRING. If typeConstruction0 parameter 35 * is DOT_SEPARATED_ARRAY then id0 definition is represented by numbers separated 36 * with dots (example: "1.2.840.113549.1.1.1"). In case of NAME_STRING, id0 37 * definition is name of object identifier (example: "RSA"). 38 * @param id0 defines Object Identifier in representation determined by second 39 * parameter - typeConstruction0. 40 * @param typeConstruction0 can take values DOT_SEPARATED_ARRAY and NAME_STRING 41 * @exception SMIMEException if wrong type of parameters are passed to the 42 * constructor. Also, it can be thrown from super class constructor or its 43 * addContent method. 44 */ 45 public AlgorithmIdentifier(String id0, String typeConstruction0) throws SMIMEException { 46 DERObjectIdentifier temp = new DERObjectIdentifier(id0, typeConstruction0); // Finding apropriate identifier 47 48 super.addContent(temp.getDEREncoded()); // Adding identifier to AlgorithmIdentifier 49 } 50 51 /*** 52 * Array of numbers is used for construction of DERObjectIdentifier. Every number in 53 * array represents one number between dots in object identifier string. 54 * @param arrayID0 array of defined numbers (example: for RSA algoriths, numbers 55 * are 1, 2, 840, 113549, 1, 1, and 1) 56 * @exception SMIMEException if wrong type of parameters are passed to the 57 * constructor. Also, it can be thrown from super class constructor or its 58 * addContent method. 59 */ 60 public AlgorithmIdentifier(int[] arrayID0) throws SMIMEException { 61 DERObjectIdentifier temp = new DERObjectIdentifier(arrayID0); // Finding apropriate identifier 62 63 super.addContent(temp.getDEREncoded()); // Adding identifier to AlgorithmIdentifier 64 } 65 66 /*** 67 * Adds DERNull parameter to AlgorithmIdentifier 68 * @exception SMIMEException thrown from super class addContent method. 69 */ 70 public void addNullToAlgorithmId() throws SMIMEException { 71 super.addContent(new DERNull().getDEREncoded()); 72 } 73 74 /*** 75 * Adds parameter to AlgorithmIdentifier 76 * @param parameter0 byte array representation of appropriate parameter 77 * @exception SMIMEException thrown from super class addContent method. 78 */ 79 public void addParamToAlgorithmId(byte[] parameter0) throws SMIMEException { 80 super.addContent(parameter0); 81 } 82 } 83

This page was automatically generated by Maven