2002/03/21 01:19:32
[org.ibex.core.git] / src / org / bouncycastle / asn1 / DERT61String.java
diff --git a/src/org/bouncycastle/asn1/DERT61String.java b/src/org/bouncycastle/asn1/DERT61String.java
new file mode 100644 (file)
index 0000000..4412efc
--- /dev/null
@@ -0,0 +1,43 @@
+package org.bouncycastle.asn1;
+
+import java.io.*;
+
+/**
+ * DER T61String (also the teletex string)
+ */
+public class DERT61String
+    extends DERObject
+    implements DERString
+{
+    String  string;
+
+    /**
+     * basic constructor - with bytes.
+     */
+    public DERT61String(
+        byte[]   string)
+    {
+        this.string = new String(string);
+    }
+
+    /**
+     * basic constructor - with string.
+     */
+    public DERT61String(
+        String   string)
+    {
+        this.string = string;
+    }
+
+    public String getString()
+    {
+        return string;
+    }
+
+    void encode(
+        DEROutputStream  out)
+        throws IOException
+    {
+        out.writeEncoded(T61_STRING, string.getBytes());
+    }
+}