1 package org.bouncycastle.asn1;
6 * DER T61String (also the teletex string)
8 public class DERT61String
15 * return a T61 string from the passed in object.
17 * @exception IllegalArgumentException if the object cannot be converted.
19 public static DERT61String getInstance(
22 if (obj == null || obj instanceof DERT61String)
24 return (DERT61String)obj;
27 if (obj instanceof ASN1OctetString)
29 return new DERT61String(((ASN1OctetString)obj).getOctets());
32 if (obj instanceof ASN1TaggedObject)
34 return getInstance(((ASN1TaggedObject)obj).getObject());
37 throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
41 * return an T61 String from a tagged object.
43 * @param obj the tagged object holding the object we want
44 * @param explicit true if the object is meant to be explicitly
45 * tagged false otherwise.
46 * @exception IllegalArgumentException if the tagged object cannot
49 public static DERT61String getInstance(
53 return getInstance(obj.getObject());
57 * basic constructor - with bytes.
62 this.string = new String(string);
66 * basic constructor - with string.
74 public String getString()
83 out.writeEncoded(T61_STRING, string.getBytes());
86 public boolean equals(
89 if ((o == null) || !(o instanceof DERT61String))
94 return this.getString().equals(((DERT61String)o).getString());