1 /*
2  * @(#) $Id: AlgorithmIdentifier.java,v 1.3 2003/07/08 08:13:53 pankaj Exp $
3  *
4  * Copyright (c) 2002-03 by Pankaj Kumar (http://www.pankaj-k.net). 
5  * All rights reserved.
6  *
7  * The license governing the use of this file can be found in the 
8  * root directory of the containing software.
9  */
10package org.jstk.pki;
11
12import java.io.IOException;
13import org.jstk.asn1.*;
14
15/*
16 * AlgorithmIdentifier ::= SEQUENCE {
17 *   algorithm      OBJECT IDENTIFIER,
18 *   parameters     ANY DEFINED BY algorithm OPTIONAL }
19 */
20public class AlgorithmIdentifier extends ASN1Seq {
21    private ASN1Oid algorithm = new ASN1Oid();
22    private ASN1Any parameters = new ASN1Any();
23
24    public AlgorithmIdentifier(){
25        super();
26        add(algorithm);
27        add(parameters);
28    }
29
30    public void setOid(String oid){
31        algorithm.setOid(oid);
32    }
33
34    public void setParams(ASN1Type params){
35        parameters.setInstance(params);
36    }
37
38    public String toString(){
39        StringBuffer sb = new StringBuffer();
40        sb.append("AlgorithmIdentifier-SEQ(" + algorithm.toString() + ", ");
41        sb.append(parameters.toString() + ")");
42        return sb.toString();
43    }
44}
45
46