*/
public AlgorithmIdentifier(ASN1ObjectIdentifier oid, ASN1Type params)
throws ASN1Exception {
super(2);
DEREncoder enc;
ByteArrayOutputStream bos;
if (oid == null)
throw new NullPointerException("Need an OID!");
algorithm_ = (ASN1ObjectIdentifier) oid.clone();
try {
if (params == null || (params instanceof ASN1Null))
parameters_ = new ASN1Opaque(ASN1.TAG_NULL,
ASN1.CLASS_UNIVERSAL, new byte[0]);
else {
bos = new ByteArrayOutputStream();
enc = new DEREncoder(bos);
params.encode(enc);
parameters_ = new ASN1Opaque(bos.toByteArray());
bos.close();
}