diff --git a/configure.ac b/configure.ac
index ed213a9..2f552bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,15 +22,24 @@ AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_HEADERS(config.h)
 AM_INIT_AUTOMAKE([1.10 -Wall -Werror -Wno-override])
-AM_SILENT_RULES([yes])
 
 # Library code modified:                              REVISION++
 # Interfaces changed/added/removed:   CURRENT++       REVISION=0
 # Interfaces added:                             AGE++
 # Interfaces removed:                           AGE=0
-AC_SUBST(LT_CURRENT, 8)
-AC_SUBST(LT_REVISION, 2)
-AC_SUBST(LT_AGE, 2)
+#
+# The following are the original values from libtasn1-3.5:
+#
+#     AC_SUBST(LT_CURRENT, 8)
+#     AC_SUBST(LT_REVISION, 2)
+#     AC_SUBST(LT_AGE, 2)
+#
+# Since this patched package is libtasn1-3.5 wrapped to expose the same
+# API/ABI as libtasn1-1.5, we change the LT_* values to be the same
+# as they were in libtasn1-1.5.
+AC_SUBST(LT_CURRENT, 3)
+AC_SUBST(LT_REVISION, 16)
+AC_SUBST(LT_AGE, 0)
 
 AC_PROG_CC
 gl_EARLY
@@ -40,14 +49,13 @@ AC_PROG_YACC
 dnl Checks for programs.
 AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir)
 AC_LIBTOOL_WIN32_DLL
-AM_PROG_AR
 AM_PROG_LIBTOOL
 GTK_DOC_CHECK(1.2)
 
 AC_CHECK_SIZEOF(unsigned long int, 4)
 AC_CHECK_SIZEOF(unsigned int, 4)
 
-sj_UPDATE_HEADER_VERSION([$srcdir/lib/libtasn1.h])
+sj_UPDATE_HEADER_VERSION([$srcdir/lib/libtasn1-internal.h])
 
 # For gnulib compatibility modules.
 gl_INIT
diff --git a/doc/gdoc b/doc/gdoc
index e3db762..2eb0dac 100755
--- a/doc/gdoc
+++ b/doc/gdoc
@@ -794,6 +794,7 @@ sub dump_function {
 	$prototype =~ m/^(\w+\s+\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\)]*)\)/)  {
 	$return_type = $1;
 	$function_name = $2;
+	$function_name =~ s/^asn1_internal/asn1/;
 	$args = $3;
 
 #	print STDERR "ARGS = '$args'\n";
diff --git a/examples/CertificateExample.c b/examples/CertificateExample.c
index a62ea79..32bc611 100644
--- a/examples/CertificateExample.c
+++ b/examples/CertificateExample.c
@@ -27,7 +27,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include "libtasn1.h"
+#include "libtasn1-internal.h"
 
 
 static char *
@@ -89,7 +89,7 @@ get_Name_type (ASN1_TYPE cert_def, ASN1_TYPE cert, const char *root,
       my_ltostr (k, counter);
       strcat (name, counter);
       len = sizeof (str) - 1;
-      result = asn1_read_value (cert, name, str, &len);
+      result = asn1_internal_read_value (cert, name, str, &len);
       if (result == ASN1_ELEMENT_NOT_FOUND)
 	break;
       k2 = 1;
@@ -100,90 +100,90 @@ get_Name_type (ASN1_TYPE cert_def, ASN1_TYPE cert, const char *root,
 	  my_ltostr (k2, counter);
 	  strcat (name2, counter);
 	  len = sizeof (str) - 1;
-	  result = asn1_read_value (cert, name2, str, &len);
+	  result = asn1_internal_read_value (cert, name2, str, &len);
 	  if (result == ASN1_ELEMENT_NOT_FOUND)
 	    break;
 	  strcpy (name3, name2);
 	  strcat (name3, ".type");
 	  len = sizeof (str) - 1;
-	  result = asn1_read_value (cert, name3, str, &len);
+	  result = asn1_internal_read_value (cert, name3, str, &len);
 	  strcpy (name3, name2);
 	  strcat (name3, ".value");
 	  if (result == ASN1_SUCCESS)
 	    {
 	      len = sizeof (str2) - 1;
 	      result =
-		asn1_read_value (cert_def,
+		asn1_internal_read_value (cert_def,
 				 "PKIX1Implicit88.id-at-countryName", str2,
 				 &len);
 	      if (!strcmp (str, str2))
 		{
-		  asn1_create_element (cert_def,
-				       "PKIX1Implicit88.X520OrganizationName",
-				       &value);
+		  asn1_internal_create_element (cert_def,
+						"PKIX1Implicit88.X520OrganizationName",
+						&value);
 		  len = sizeof (str) - 1;
-		  asn1_read_value (cert, name3, str, &len);
-		  asn1_der_decoding (&value, str, len, errorDescription);
+		  asn1_internal_read_value (cert, name3, str, &len);
+		  asn1_internal_der_decoding (&value, str, len, errorDescription);
 		  len = sizeof (str) - 1;
-		  asn1_read_value (value, "", str, &len);	/* CHOICE */
+		  asn1_internal_read_value (value, "", str, &len);	/* CHOICE */
 		  strcpy (name3, str);
 		  len = sizeof (str) - 1;
-		  asn1_read_value (value, name3, str, &len);
+		  asn1_internal_read_value (value, name3, str, &len);
 		  str[len] = 0;
 		  strcat (answer, " C=");
 		  strcat (answer, str);
-		  asn1_delete_structure (&value);
+		  asn1_internal_delete_structure (&value);
 		}
 	      else
 		{
 		  len = sizeof (str2) - 1;
 		  result =
-		    asn1_read_value (cert_def,
+		    asn1_internal_read_value (cert_def,
 				     "PKIX1Implicit88.id-at-organizationName",
 				     str2, &len);
 		  if (!strcmp (str, str2))
 		    {
-		      asn1_create_element (cert_def,
-					   "PKIX1Implicit88.X520OrganizationName",
-					   &value);
+		      asn1_internal_create_element (cert_def,
+						    "PKIX1Implicit88.X520OrganizationName",
+						    &value);
 		      len = sizeof (str) - 1;
-		      asn1_read_value (cert, name3, str, &len);
-		      asn1_der_decoding (&value, str, len, errorDescription);
+		      asn1_internal_read_value (cert, name3, str, &len);
+		      asn1_internal_der_decoding (&value, str, len, errorDescription);
 		      len = sizeof (str) - 1;
-		      asn1_read_value (value, "", str, &len);	/* CHOICE */
+		      asn1_internal_read_value (value, "", str, &len);	/* CHOICE */
 		      strcpy (name3, str);
 		      len = sizeof (str) - 1;
-		      asn1_read_value (value, name3, str, &len);
+		      asn1_internal_read_value (value, name3, str, &len);
 		      str[len] = 0;
 		      strcat (answer, " O=");
 		      strcat (answer, str);
-		      asn1_delete_structure (&value);
+		      asn1_internal_delete_structure (&value);
 		    }
 		  else
 		    {
 		      len = sizeof (str2) - 1;
 		      result =
-			asn1_read_value (cert_def,
+			asn1_internal_read_value (cert_def,
 					 "PKIX1Implicit88.id-at-organizationalUnitName",
 					 str2, &len);
 		      if (!strcmp (str, str2))
 			{
-			  asn1_create_element (cert_def,
-					       "PKIX1Implicit88.X520OrganizationalUnitName",
-					       &value);
+			  asn1_internal_create_element (cert_def,
+							"PKIX1Implicit88.X520OrganizationalUnitName",
+							&value);
 			  len = sizeof (str) - 1;
-			  asn1_read_value (cert, name3, str, &len);
-			  asn1_der_decoding (&value, str, len,
+			  asn1_internal_read_value (cert, name3, str, &len);
+			  asn1_internal_der_decoding (&value, str, len,
 					     errorDescription);
 			  len = sizeof (str) - 1;
-			  asn1_read_value (value, "", str, &len);	/* CHOICE */
+			  asn1_internal_read_value (value, "", str, &len);	/* CHOICE */
 			  strcpy (name3, str);
 			  len = sizeof (str) - 1;
-			  asn1_read_value (value, name3, str, &len);
+			  asn1_internal_read_value (value, name3, str, &len);
 			  str[len] = 0;
 			  strcat (answer, " OU=");
 			  strcat (answer, str);
-			  asn1_delete_structure (&value);
+			  asn1_internal_delete_structure (&value);
 			}
 		    }
 		}
@@ -222,7 +222,7 @@ create_certificate (ASN1_TYPE cert_def, unsigned char *der, int *der_len)
   max_len = *der_len;
 
   result =
-    asn1_create_element (cert_def, "PKIX1Implicit88.Certificate", &cert1);
+    asn1_internal_create_element (cert_def, "PKIX1Implicit88.Certificate", &cert1);
 
   /* Use the next 3 lines to visit the empty certificate */
   /* printf("-----------------\n");
@@ -230,234 +230,234 @@ create_certificate (ASN1_TYPE cert_def, unsigned char *der, int *der_len)
      printf("-----------------\n"); */
 
   /* version: v3(2) */
-  result = asn1_write_value (cert1, "tbsCertificate.version", "v3", 0);
+  result = asn1_internal_write_value (cert1, "tbsCertificate.version", "v3", 0);
 
   /* serialNumber: 17 */
-  result = asn1_write_value (cert1, "tbsCertificate.serialNumber", "17", 0);
+  result = asn1_internal_write_value (cert1, "tbsCertificate.serialNumber", "17", 0);
 
   /* signature: dsa-with-sha1 */
   len = sizeof (str) - 1;
   result =
-    asn1_read_value (cert_def, "PKIX1Implicit88.id-dsa-with-sha1", str, &len);
+    asn1_internal_read_value (cert_def, "PKIX1Implicit88.id-dsa-with-sha1", str, &len);
   result =
-    asn1_write_value (cert1, "tbsCertificate.signature.algorithm", str, 1);
+    asn1_internal_write_value (cert1, "tbsCertificate.signature.algorithm", str, 1);
 
-  result = asn1_write_value (cert1, "tbsCertificate.signature.parameters",
+  result = asn1_internal_write_value (cert1, "tbsCertificate.signature.parameters",
 			     NULL, 0);
 
 
   /* issuer: Country="US" Organization="gov" OrganizationUnit="nist" */
   result =
-    asn1_write_value (cert1, "tbsCertificate.issuer", "rdnSequence", 12);
+    asn1_internal_write_value (cert1, "tbsCertificate.issuer", "rdnSequence", 12);
 
   result =
-    asn1_write_value (cert1, "tbsCertificate.issuer.rdnSequence", "NEW", 1);
+    asn1_internal_write_value (cert1, "tbsCertificate.issuer.rdnSequence", "NEW", 1);
   result =
-    asn1_write_value (cert1, "tbsCertificate.issuer.rdnSequence.?LAST", "NEW",
+    asn1_internal_write_value (cert1, "tbsCertificate.issuer.rdnSequence.?LAST", "NEW",
 		      1);
   /* C */
   len = sizeof (str) - 1;
   result =
-    asn1_read_value (cert_def, "PKIX1Implicit88.id-at-countryName", str,
+    asn1_internal_read_value (cert_def, "PKIX1Implicit88.id-at-countryName", str,
 		     &len);
   result =
-    asn1_write_value (cert1,
+    asn1_internal_write_value (cert1,
 		      "tbsCertificate.issuer.rdnSequence.?LAST.?LAST.type",
 		      str, 1);
   result =
-    asn1_create_element (cert_def, "PKIX1Implicit88.X520countryName", &value);
-  result = asn1_write_value (value, "", "US", 2);
+    asn1_internal_create_element (cert_def, "PKIX1Implicit88.X520countryName", &value);
+  result = asn1_internal_write_value (value, "", "US", 2);
   *der_len = max_len;
-  result = asn1_der_coding (value, "", der, der_len, errorDescription);
-  asn1_delete_structure (&value);
+  result = asn1_internal_der_coding (value, "", der, der_len, errorDescription);
+  asn1_internal_delete_structure (&value);
   result =
-    asn1_write_value (cert1,
+    asn1_internal_write_value (cert1,
 		      "tbsCertificate.issuer.rdnSequence.?LAST.?LAST.value",
 		      der, *der_len);
 
 
   result =
-    asn1_write_value (cert1, "tbsCertificate.issuer.rdnSequence", "NEW", 1);
+    asn1_internal_write_value (cert1, "tbsCertificate.issuer.rdnSequence", "NEW", 1);
   result =
-    asn1_write_value (cert1, "tbsCertificate.issuer.rdnSequence.?LAST", "NEW",
+    asn1_internal_write_value (cert1, "tbsCertificate.issuer.rdnSequence.?LAST", "NEW",
 		      1);
   /* O */
   len = sizeof (str) - 1;
   result =
-    asn1_read_value (cert_def, "PKIX1Implicit88.id-at-organizationName", str,
+    asn1_internal_read_value (cert_def, "PKIX1Implicit88.id-at-organizationName", str,
 		     &len);
   result =
-    asn1_write_value (cert1,
+    asn1_internal_write_value (cert1,
 		      "tbsCertificate.issuer.rdnSequence.?LAST.?LAST.type",
 		      str, 1);
   result =
-    asn1_create_element (cert_def, "PKIX1Implicit88.X520OrganizationName",
-			 &value);
-  result = asn1_write_value (value, "", "printableString", 1);
-  result = asn1_write_value (value, "printableString", "gov", 3);
+    asn1_internal_create_element (cert_def, "PKIX1Implicit88.X520OrganizationName",
+				  &value);
+  result = asn1_internal_write_value (value, "", "printableString", 1);
+  result = asn1_internal_write_value (value, "printableString", "gov", 3);
   *der_len = max_len;
-  result = asn1_der_coding (value, "", der, der_len, errorDescription);
-  asn1_delete_structure (&value);
+  result = asn1_internal_der_coding (value, "", der, der_len, errorDescription);
+  asn1_internal_delete_structure (&value);
   result =
-    asn1_write_value (cert1,
+    asn1_internal_write_value (cert1,
 		      "tbsCertificate.issuer.rdnSequence.?LAST.?LAST.value",
 		      der, *der_len);
 
 
   result =
-    asn1_write_value (cert1, "tbsCertificate.issuer.rdnSequence", "NEW", 1);
+    asn1_internal_write_value (cert1, "tbsCertificate.issuer.rdnSequence", "NEW", 1);
   result =
-    asn1_write_value (cert1, "tbsCertificate.issuer.rdnSequence.?LAST", "NEW",
+    asn1_internal_write_value (cert1, "tbsCertificate.issuer.rdnSequence.?LAST", "NEW",
 		      1);
 
   /* OU */
   len = sizeof (str) - 1;
   result =
-    asn1_read_value (cert_def, "PKIX1Implicit88.id-at-organizationalUnitName",
+    asn1_internal_read_value (cert_def, "PKIX1Implicit88.id-at-organizationalUnitName",
 		     str, &len);
   result =
-    asn1_write_value (cert1,
+    asn1_internal_write_value (cert1,
 		      "tbsCertificate.issuer.rdnSequence.?LAST.?LAST.type",
 		      str, 1);
   result =
-    asn1_create_element (cert_def,
-			 "PKIX1Implicit88.X520OrganizationalUnitName",
-			 &value);
-  result = asn1_write_value (value, "", "printableString", 1);
-  result = asn1_write_value (value, "printableString", "nist", 4);
+    asn1_internal_create_element (cert_def,
+				  "PKIX1Implicit88.X520OrganizationalUnitName",
+				  &value);
+  result = asn1_internal_write_value (value, "", "printableString", 1);
+  result = asn1_internal_write_value (value, "printableString", "nist", 4);
   *der_len = max_len;
-  result = asn1_der_coding (value, "", der, der_len, errorDescription);
-  asn1_delete_structure (&value);
+  result = asn1_internal_der_coding (value, "", der, der_len, errorDescription);
+  asn1_internal_delete_structure (&value);
   result =
-    asn1_write_value (cert1,
+    asn1_internal_write_value (cert1,
 		      "tbsCertificate.issuer.rdnSequence.?LAST.?LAST.value",
 		      der, *der_len);
 
 
   /* validity */
   result =
-    asn1_write_value (cert1, "tbsCertificate.validity.notBefore", "utcTime",
+    asn1_internal_write_value (cert1, "tbsCertificate.validity.notBefore", "utcTime",
 		      1);
   result =
-    asn1_write_value (cert1, "tbsCertificate.validity.notBefore.utcTime",
+    asn1_internal_write_value (cert1, "tbsCertificate.validity.notBefore.utcTime",
 		      "970630000000Z", 1);
 
   result =
-    asn1_write_value (cert1, "tbsCertificate.validity.notAfter", "utcTime",
+    asn1_internal_write_value (cert1, "tbsCertificate.validity.notAfter", "utcTime",
 		      1);
   result =
-    asn1_write_value (cert1, "tbsCertificate.validity.notAfter.utcTime",
+    asn1_internal_write_value (cert1, "tbsCertificate.validity.notAfter.utcTime",
 		      "971231000000Z", 1);
 
 
 
   /* subject: Country="US" Organization="gov" OrganizationUnit="nist" */
   result =
-    asn1_write_value (cert1, "tbsCertificate.subject", "rdnSequence", 1);
+    asn1_internal_write_value (cert1, "tbsCertificate.subject", "rdnSequence", 1);
 
   result =
-    asn1_write_value (cert1, "tbsCertificate.subject.rdnSequence", "NEW", 1);
+    asn1_internal_write_value (cert1, "tbsCertificate.subject.rdnSequence", "NEW", 1);
   result =
-    asn1_write_value (cert1, "tbsCertificate.subject.rdnSequence.?LAST",
+    asn1_internal_write_value (cert1, "tbsCertificate.subject.rdnSequence.?LAST",
 		      "NEW", 1);
   /* C */
   len = sizeof (str) - 1;
   result =
-    asn1_read_value (cert_def, "PKIX1Implicit88.id-at-countryName", str,
+    asn1_internal_read_value (cert_def, "PKIX1Implicit88.id-at-countryName", str,
 		     &len);
   result =
-    asn1_write_value (cert1,
+    asn1_internal_write_value (cert1,
 		      "tbsCertificate.subject.rdnSequence.?LAST.?LAST.type",
 		      str, 1);
   result =
-    asn1_create_element (cert_def, "PKIX1Implicit88.X520countryName", &value);
-  result = asn1_write_value (value, "", "US", 2);
+    asn1_internal_create_element (cert_def, "PKIX1Implicit88.X520countryName", &value);
+  result = asn1_internal_write_value (value, "", "US", 2);
   *der_len = max_len;
-  result = asn1_der_coding (value, "", der, der_len, errorDescription);
-  asn1_delete_structure (&value);
+  result = asn1_internal_der_coding (value, "", der, der_len, errorDescription);
+  asn1_internal_delete_structure (&value);
   result =
-    asn1_write_value (cert1,
+    asn1_internal_write_value (cert1,
 		      "tbsCertificate.subject.rdnSequence.?LAST.?LAST.value",
 		      der, *der_len);
 
 
   result =
-    asn1_write_value (cert1, "tbsCertificate.subject.rdnSequence", "NEW", 4);
+    asn1_internal_write_value (cert1, "tbsCertificate.subject.rdnSequence", "NEW", 4);
   result =
-    asn1_write_value (cert1, "tbsCertificate.subject.rdnSequence.?LAST",
+    asn1_internal_write_value (cert1, "tbsCertificate.subject.rdnSequence.?LAST",
 		      "NEW", 4);
   /* O */
   len = sizeof (str) - 1;
   result =
-    asn1_read_value (cert_def, "PKIX1Implicit88.id-at-organizationName", str,
+    asn1_internal_read_value (cert_def, "PKIX1Implicit88.id-at-organizationName", str,
 		     &len);
   result =
-    asn1_write_value (cert1,
+    asn1_internal_write_value (cert1,
 		      "tbsCertificate.subject.rdnSequence.?LAST.?LAST.type",
 		      str, 1);
   result =
-    asn1_create_element (cert_def, "PKIX1Implicit88.X520OrganizationName",
-			 &value);
-  result = asn1_write_value (value, "", "printableString", 1);
-  result = asn1_write_value (value, "printableString", "gov", 3);
+    asn1_internal_create_element (cert_def, "PKIX1Implicit88.X520OrganizationName",
+				  &value);
+  result = asn1_internal_write_value (value, "", "printableString", 1);
+  result = asn1_internal_write_value (value, "printableString", "gov", 3);
   *der_len = max_len;
-  result = asn1_der_coding (value, "", der, der_len, errorDescription);
-  asn1_delete_structure (&value);
+  result = asn1_internal_der_coding (value, "", der, der_len, errorDescription);
+  asn1_internal_delete_structure (&value);
   result =
-    asn1_write_value (cert1,
+    asn1_internal_write_value (cert1,
 		      "tbsCertificate.subject.rdnSequence.?LAST.?LAST.value",
 		      der, *der_len);
 
 
   result =
-    asn1_write_value (cert1, "tbsCertificate.subject.rdnSequence", "NEW", 4);
+    asn1_internal_write_value (cert1, "tbsCertificate.subject.rdnSequence", "NEW", 4);
   result =
-    asn1_write_value (cert1, "tbsCertificate.subject.rdnSequence.?LAST",
+    asn1_internal_write_value (cert1, "tbsCertificate.subject.rdnSequence.?LAST",
 		      "NEW", 4);
   /* OU */
   len = sizeof (str) - 1;
   result =
-    asn1_read_value (cert_def, "PKIX1Implicit88.id-at-organizationalUnitName",
+    asn1_internal_read_value (cert_def, "PKIX1Implicit88.id-at-organizationalUnitName",
 		     str, &len);
   result =
-    asn1_write_value (cert1,
+    asn1_internal_write_value (cert1,
 		      "tbsCertificate.subject.rdnSequence.?LAST.?LAST.type",
 		      str, 1);
   result =
-    asn1_create_element (cert_def,
-			 "PKIX1Implicit88.X520OrganizationalUnitName",
-			 &value);
-  result = asn1_write_value (value, "", "printableString", 1);
-  result = asn1_write_value (value, "printableString", "nist", 4);
+    asn1_internal_create_element (cert_def,
+				  "PKIX1Implicit88.X520OrganizationalUnitName",
+				  &value);
+  result = asn1_internal_write_value (value, "", "printableString", 1);
+  result = asn1_internal_write_value (value, "printableString", "nist", 4);
   *der_len = max_len;
-  result = asn1_der_coding (value, "", der, der_len, errorDescription);
-  asn1_delete_structure (&value);
+  result = asn1_internal_der_coding (value, "", der, der_len, errorDescription);
+  asn1_internal_delete_structure (&value);
   result =
-    asn1_write_value (cert1,
+    asn1_internal_write_value (cert1,
 		      "tbsCertificate.subject.rdnSequence.?LAST.?LAST.value",
 		      der, *der_len);
 
 
   /* subjectPublicKeyInfo: dsa with parameters=Dss-Parms */
   len = sizeof (str) - 1;
-  result = asn1_read_value (cert_def, "PKIX1Implicit88.id-dsa", str, &len);
+  result = asn1_internal_read_value (cert_def, "PKIX1Implicit88.id-dsa", str, &len);
   result =
-    asn1_write_value (cert1,
+    asn1_internal_write_value (cert1,
 		      "tbsCertificate.subjectPublicKeyInfo.algorithm.algorithm",
 		      str, 1);
   result =
-    asn1_create_element (cert_def, "PKIX1Implicit88.Dss-Parms", &param);
+    asn1_internal_create_element (cert_def, "PKIX1Implicit88.Dss-Parms", &param);
   str2 = (const unsigned char *) "\xd4\x38";	/* only an example */
-  result = asn1_write_value (param, "p", str2, 128);
+  result = asn1_internal_write_value (param, "p", str2, 128);
   str2 = (const unsigned char *) "\xd4\x38";	/* only an example */
-  result = asn1_write_value (param, "q", str2, 20);
+  result = asn1_internal_write_value (param, "q", str2, 20);
   str2 = (const unsigned char *) "\xd4\x38";	/* only an example */
-  result = asn1_write_value (param, "g", str2, 128);
+  result = asn1_internal_write_value (param, "g", str2, 128);
   *der_len = max_len;
-  result = asn1_der_coding (param, "", der, der_len, errorDescription);
-  asn1_delete_structure (&param);
+  result = asn1_internal_der_coding (param, "", der, der_len, errorDescription);
+  asn1_internal_delete_structure (&param);
   result =
-    asn1_write_value (cert1,
+    asn1_internal_write_value (cert1,
 		      "tbsCertificate.subjectPublicKeyInfo.algorithm.parameters",
 		      der, *der_len);
 
@@ -465,69 +465,69 @@ create_certificate (ASN1_TYPE cert_def, unsigned char *der, int *der_len)
   /* subjectPublicKey */
   str2 = (const unsigned char *) "\x02\x81";	/* only an example */
   result =
-    asn1_write_value (cert1,
+    asn1_internal_write_value (cert1,
 		      "tbsCertificate.subjectPublicKeyInfo.subjectPublicKey",
 		      str2, 1048);
 
-  result = asn1_write_value (cert1, "tbsCertificate.issuerUniqueID", NULL, 0);	/* NO OPTION */
-  result = asn1_write_value (cert1, "tbsCertificate.subjectUniqueID", NULL, 0);	/* NO OPTION */
+  result = asn1_internal_write_value (cert1, "tbsCertificate.issuerUniqueID", NULL, 0);	/* NO OPTION */
+  result = asn1_internal_write_value (cert1, "tbsCertificate.subjectUniqueID", NULL, 0);	/* NO OPTION */
 
   /* extensions */
-  result = asn1_write_value (cert1, "tbsCertificate.extensions", "NEW", 1);
+  result = asn1_internal_write_value (cert1, "tbsCertificate.extensions", "NEW", 1);
   len = sizeof (str) - 1;
   result =
-    asn1_read_value (cert_def, "PKIX1Implicit88.id-ce-basicConstraints", str,
+    asn1_internal_read_value (cert_def, "PKIX1Implicit88.id-ce-basicConstraints", str,
 		     &len);
-  result = asn1_write_value (cert1, "tbsCertificate.extensions.?LAST.extnID", str, 1);	/*   basicConstraints */
+  result = asn1_internal_write_value (cert1, "tbsCertificate.extensions.?LAST.extnID", str, 1);	/*   basicConstraints */
   result =
-    asn1_write_value (cert1, "tbsCertificate.extensions.?LAST.critical",
+    asn1_internal_write_value (cert1, "tbsCertificate.extensions.?LAST.critical",
 		      "TRUE", 1);
   result =
-    asn1_create_element (cert_def, "PKIX1Implicit88.BasicConstraints",
-			 &constr);
-  result = asn1_write_value (constr, "cA", "TRUE", 1);
-  result = asn1_write_value (constr, "pathLenConstraint", NULL, 0);
+    asn1_internal_create_element (cert_def, "PKIX1Implicit88.BasicConstraints",
+				  &constr);
+  result = asn1_internal_write_value (constr, "cA", "TRUE", 1);
+  result = asn1_internal_write_value (constr, "pathLenConstraint", NULL, 0);
   *der_len = max_len;
-  result = asn1_der_coding (constr, "", der, der_len, errorDescription);
-  result = asn1_delete_structure (&constr);
+  result = asn1_internal_der_coding (constr, "", der, der_len, errorDescription);
+  result = asn1_internal_delete_structure (&constr);
   result =
-    asn1_write_value (cert1, "tbsCertificate.extensions.?LAST.extnValue", der,
+    asn1_internal_write_value (cert1, "tbsCertificate.extensions.?LAST.extnValue", der,
 		      *der_len);
 
 
-  result = asn1_write_value (cert1, "tbsCertificate.extensions", "NEW", 1);
+  result = asn1_internal_write_value (cert1, "tbsCertificate.extensions", "NEW", 1);
   len = sizeof (str) - 1;
   result =
-    asn1_read_value (cert_def, "PKIX1Implicit88.id-ce-subjectKeyIdentifier",
+    asn1_internal_read_value (cert_def, "PKIX1Implicit88.id-ce-subjectKeyIdentifier",
 		     str, &len);
-  result = asn1_write_value (cert1, "tbsCertificate.extensions.?LAST.extnID", str, 1);	/* subjectKeyIdentifier */
+  result = asn1_internal_write_value (cert1, "tbsCertificate.extensions.?LAST.extnID", str, 1);	/* subjectKeyIdentifier */
   result =
-    asn1_write_value (cert1, "tbsCertificate.extensions.?LAST.critical",
+    asn1_internal_write_value (cert1, "tbsCertificate.extensions.?LAST.critical",
 		      "FALSE", 1);
   str2 = (const unsigned char *) "\x04\x14\xe7\x26\xc5";	/* only an example */
   result =
-    asn1_write_value (cert1, "tbsCertificate.extensions.?LAST.extnValue",
+    asn1_internal_write_value (cert1, "tbsCertificate.extensions.?LAST.extnValue",
 		      str2, 22);
 
 
   /* signatureAlgorithm: dsa-with-sha  */
   len = sizeof (str) - 1;
   result =
-    asn1_read_value (cert_def, "PKIX1Implicit88.id-dsa-with-sha1", str, &len);
-  result = asn1_write_value (cert1, "signatureAlgorithm.algorithm", str, 1);
-  result = asn1_write_value (cert1, "signatureAlgorithm.parameters", NULL, 0);	/* NO OPTION */
+    asn1_internal_read_value (cert_def, "PKIX1Implicit88.id-dsa-with-sha1", str, &len);
+  result = asn1_internal_write_value (cert1, "signatureAlgorithm.algorithm", str, 1);
+  result = asn1_internal_write_value (cert1, "signatureAlgorithm.parameters", NULL, 0);	/* NO OPTION */
 
 
   /* signature */
   *der_len = max_len;
   result =
-    asn1_der_coding (cert1, "tbsCertificate", der, der_len, errorDescription);
+    asn1_internal_der_coding (cert1, "tbsCertificate", der, der_len, errorDescription);
   if (result != ASN1_SUCCESS)
     {
       printf ("\n'tbsCertificate' encoding creation: ERROR\n");
     }
   /* add the lines for the signature on der[0]..der[der_len-1]: result in str2 */
-  result = asn1_write_value (cert1, "signature", str2, 368);	/* dsa-with-sha */
+  result = asn1_internal_write_value (cert1, "signature", str2, 368);	/* dsa-with-sha */
 
 
   /* Use the next 3 lines to visit the certificate */
@@ -536,7 +536,7 @@ create_certificate (ASN1_TYPE cert_def, unsigned char *der, int *der_len)
      printf("-----------------\n"); */
 
   *der_len = max_len;
-  result = asn1_der_coding (cert1, "", der, der_len, errorDescription);
+  result = asn1_internal_der_coding (cert1, "", der, der_len, errorDescription);
   if (result != ASN1_SUCCESS)
     {
       printf ("\n'certificate' encoding creation: ERROR\n");
@@ -551,7 +551,7 @@ create_certificate (ASN1_TYPE cert_def, unsigned char *der, int *der_len)
   printf ("\n-----------------\n");
 
   /* Clear the "certificate1" structure */
-  asn1_delete_structure (&cert1);
+  asn1_internal_delete_structure (&cert1);
 }
 
 
@@ -573,9 +573,9 @@ get_certificate (ASN1_TYPE cert_def, unsigned char *der, int der_len)
   ASN1_TYPE cert2 = ASN1_TYPE_EMPTY;
   char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE];
 
-  asn1_create_element (cert_def, "PKIX1Implicit88.Certificate", &cert2);
+  asn1_internal_create_element (cert_def, "PKIX1Implicit88.Certificate", &cert2);
 
-  result = asn1_der_decoding (&cert2, der, der_len, errorDescription);
+  result = asn1_internal_der_decoding (&cert2, der, der_len, errorDescription);
 
   if (result != ASN1_SUCCESS)
     {
@@ -594,22 +594,22 @@ get_certificate (ASN1_TYPE cert_def, unsigned char *der, int der_len)
 
   /* Verify sign */
   len = sizeof (str) - 1;
-  result = asn1_read_value (cert2, "signatureAlgorithm.algorithm", str, &len);
+  result = asn1_internal_read_value (cert2, "signatureAlgorithm.algorithm", str, &len);
 
   len = sizeof (str2) - 1;
   result =
-    asn1_read_value (cert_def, "PKIX1Implicit88.id-dsa-with-sha1", str2,
+    asn1_internal_read_value (cert_def, "PKIX1Implicit88.id-dsa-with-sha1", str2,
 		     &len);
   if (!strcmp ((char *) str, (char *) str2))
     {				/* dsa-with-sha */
 
-      result = asn1_der_decoding_startEnd (cert2, der, der_len,
+      result = asn1_internal_der_decoding_startEnd (cert2, der, der_len,
 					   "tbsCertificate", &start, &end);
 
       /* add the lines to calculate the sha on der[start]..der[end] */
 
       len = sizeof (str) - 1;
-      result = asn1_read_value (cert2, "signature", str, &len);
+      result = asn1_internal_read_value (cert2, "signature", str, &len);
 
       /* compare the previous value to signature ( with issuer public key) */
     }
@@ -621,7 +621,7 @@ get_certificate (ASN1_TYPE cert_def, unsigned char *der, int der_len)
 
 
   /* Clear the "certificate2" structure */
-  asn1_delete_structure (&cert2);
+  asn1_internal_delete_structure (&cert2);
 }
 
 extern const ASN1_ARRAY_TYPE pkix_asn1_tab[];
@@ -643,14 +643,14 @@ main (int argc, char *argv[])
 
   if (1)
     result =
-      asn1_array2tree (pkix_asn1_tab, &PKIX1Implicit88, errorDescription);
+      asn1_internal_array2tree (pkix_asn1_tab, &PKIX1Implicit88, errorDescription);
   else
     result =
-      asn1_parser2tree ("pkix.asn", &PKIX1Implicit88, errorDescription);
+      asn1_internal_parser2tree ("pkix.asn", &PKIX1Implicit88, errorDescription);
 
   if (result != ASN1_SUCCESS)
     {
-      asn1_perror (result);
+      asn1_internal_perror (result);
       printf ("%s", errorDescription);
       exit (1);
     }
@@ -667,7 +667,7 @@ main (int argc, char *argv[])
   get_certificate (PKIX1Implicit88, der, der_len);
 
   /* Clear the "PKIX1Implicit88" structures */
-  asn1_delete_structure (&PKIX1Implicit88);
+  asn1_internal_delete_structure (&PKIX1Implicit88);
 
   return 0;
 }
diff --git a/examples/CrlExample.c b/examples/CrlExample.c
index 1e59ac7..45099e2 100644
--- a/examples/CrlExample.c
+++ b/examples/CrlExample.c
@@ -27,7 +27,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include "libtasn1.h"
+#include "libtasn1-internal.h"
 
 
 
@@ -93,7 +93,7 @@ get_Name_type (ASN1_TYPE cert_def, ASN1_TYPE cert, const char *root,
       strcat (name, counter);
 
       len = sizeof (str) - 1;
-      result = asn1_read_value (cert, name, str, &len);
+      result = asn1_internal_read_value (cert, name, str, &len);
       if (result == ASN1_ELEMENT_NOT_FOUND)
 	break;
       k2 = 1;
@@ -105,97 +105,97 @@ get_Name_type (ASN1_TYPE cert_def, ASN1_TYPE cert, const char *root,
 	  strcat (name2, counter);
 
 	  len = sizeof (str) - 1;
-	  result = asn1_read_value (cert, name2, str, &len);
+	  result = asn1_internal_read_value (cert, name2, str, &len);
 	  if (result == ASN1_ELEMENT_NOT_FOUND)
 	    break;
 	  strcpy (name3, name2);
 	  strcat (name3, ".type");
 
 	  len = sizeof (str) - 1;
-	  result = asn1_read_value (cert, name3, str, &len);
+	  result = asn1_internal_read_value (cert, name3, str, &len);
 	  strcpy (name3, name2);
 	  strcat (name3, ".value");
 	  if (result == ASN1_SUCCESS)
 	    {
 	      len = sizeof (str2);
 	      result =
-		asn1_read_value (cert_def,
+		asn1_internal_read_value (cert_def,
 				 "PKIX1Implicit88.id-at-countryName", str2,
 				 &len);
 	      if (!strcmp (str, str2))
 		{
-		  asn1_create_element (cert_def,
-				       "PKIX1Implicit88.X520OrganizationName",
-				       &value);
+		  asn1_internal_create_element (cert_def,
+						"PKIX1Implicit88.X520OrganizationName",
+						&value);
 		  len = sizeof (str) - 1;
-		  asn1_read_value (cert, name3, str, &len);
+		  asn1_internal_read_value (cert, name3, str, &len);
 		  result =
-		    asn1_der_decoding (&value, str, len, errorDescription);
+		    asn1_internal_der_decoding (&value, str, len, errorDescription);
 
 		  len = sizeof (str) - 1;
-		  asn1_read_value (value, "", str, &len);	/* CHOICE */
+		  asn1_internal_read_value (value, "", str, &len);	/* CHOICE */
 
 		  strcpy (name3, str);
 
 		  len = sizeof (str) - 1;
-		  asn1_read_value (value, name3, str, &len);
+		  asn1_internal_read_value (value, name3, str, &len);
 		  str[len] = 0;
 		  strcat (answer, " C=");
 		  strcat (answer, str);
 
-		  asn1_delete_structure (&value);
+		  asn1_internal_delete_structure (&value);
 		}
 	      else
 		{
 		  len = sizeof (str2);
 		  result =
-		    asn1_read_value (cert_def,
+		    asn1_internal_read_value (cert_def,
 				     "PKIX1Implicit88.id-at-organizationName",
 				     str2, &len);
 		  if (!strcmp (str, str2))
 		    {
-		      asn1_create_element (cert_def,
-					   "PKIX1Implicit88.X520OrganizationName",
-					   &value);
+		      asn1_internal_create_element (cert_def,
+						    "PKIX1Implicit88.X520OrganizationName",
+						    &value);
 
 		      len = sizeof (str) - 1;
-		      asn1_read_value (cert, name3, str, &len);
-		      asn1_der_decoding (&value, str, len, errorDescription);
+		      asn1_internal_read_value (cert, name3, str, &len);
+		      asn1_internal_der_decoding (&value, str, len, errorDescription);
 		      len = sizeof (str) - 1;
-		      asn1_read_value (value, "", str, &len);	/* CHOICE */
+		      asn1_internal_read_value (value, "", str, &len);	/* CHOICE */
 		      strcpy (name3, str);
 		      len = sizeof (str) - 1;
-		      asn1_read_value (value, name3, str, &len);
+		      asn1_internal_read_value (value, name3, str, &len);
 		      str[len] = 0;
 		      strcat (answer, " O=");
 		      strcat (answer, str);
-		      asn1_delete_structure (&value);
+		      asn1_internal_delete_structure (&value);
 		    }
 		  else
 		    {
 		      len = sizeof (str2);
 		      result =
-			asn1_read_value (cert_def,
+			asn1_internal_read_value (cert_def,
 					 "PKIX1Implicit88.id-at-organizationalUnitName",
 					 str2, &len);
 		      if (!strcmp (str, str2))
 			{
-			  asn1_create_element (cert_def,
-					       "PKIX1Implicit88.X520OrganizationalUnitName",
-					       &value);
+			  asn1_internal_create_element (cert_def,
+							"PKIX1Implicit88.X520OrganizationalUnitName",
+							&value);
 			  len = sizeof (str) - 1;
-			  asn1_read_value (cert, name3, str, &len);
-			  asn1_der_decoding (&value, str, len,
+			  asn1_internal_read_value (cert, name3, str, &len);
+			  asn1_internal_der_decoding (&value, str, len,
 					     errorDescription);
 			  len = sizeof (str) - 1;
-			  asn1_read_value (value, "", str, &len);	/* CHOICE */
+			  asn1_internal_read_value (value, "", str, &len);	/* CHOICE */
 			  strcpy (name3, str);
 			  len = sizeof (str) - 1;
-			  asn1_read_value (value, name3, str, &len);
+			  asn1_internal_read_value (value, name3, str, &len);
 			  str[len] = 0;
 			  strcat (answer, " OU=");
 			  strcat (answer, str);
-			  asn1_delete_structure (&value);
+			  asn1_internal_delete_structure (&value);
 			}
 		    }
 		}
@@ -232,7 +232,7 @@ create_CRL (ASN1_TYPE cert_def, unsigned char *der, int *der_len)
   max_len = *der_len;
 
   result =
-    asn1_create_element (cert_def, "PKIX1Implicit88.CertificateList", &crl);
+    asn1_internal_create_element (cert_def, "PKIX1Implicit88.CertificateList", &crl);
 
   /* Use the next 3 lines to visit the empty certificate */
   /*  printf("-----------------\n");
@@ -241,156 +241,156 @@ create_CRL (ASN1_TYPE cert_def, unsigned char *der, int *der_len)
 
 
   /* version: v2(1) */
-  result = asn1_write_value (crl, "tbsCertList.version", "v2", 0);
+  result = asn1_internal_write_value (crl, "tbsCertList.version", "v2", 0);
 
 
   /* signature: dsa-with-sha */
   len = sizeof (str) - 1;
   result =
-    asn1_read_value (cert_def, "PKIX1Implicit88.id-dsa-with-sha1", str, &len);
-  result = asn1_write_value (crl, "tbsCertList.signature.algorithm", str, 1);
+    asn1_internal_read_value (cert_def, "PKIX1Implicit88.id-dsa-with-sha1", str, &len);
+  result = asn1_internal_write_value (crl, "tbsCertList.signature.algorithm", str, 1);
   result =
-    asn1_write_value (crl, "tbsCertList.signature.parameters", NULL, 0);
+    asn1_internal_write_value (crl, "tbsCertList.signature.parameters", NULL, 0);
 
 
   /* issuer: Country="US" Organization="gov" OrganizationUnit="nist" */
-  result = asn1_write_value (crl, "tbsCertList.issuer", "rdnSequence", 1);
+  result = asn1_internal_write_value (crl, "tbsCertList.issuer", "rdnSequence", 1);
 
-  result = asn1_write_value (crl, "tbsCertList.issuer.rdnSequence", "NEW", 1);
+  result = asn1_internal_write_value (crl, "tbsCertList.issuer.rdnSequence", "NEW", 1);
   result =
-    asn1_write_value (crl, "tbsCertList.issuer.rdnSequence.?LAST", "NEW", 1);
+    asn1_internal_write_value (crl, "tbsCertList.issuer.rdnSequence.?LAST", "NEW", 1);
   /* C */
   len = sizeof (str) - 1;
   result =
-    asn1_read_value (cert_def, "PKIX1Implicit88.id-at-countryName", str,
+    asn1_internal_read_value (cert_def, "PKIX1Implicit88.id-at-countryName", str,
 		     &len);
   result =
-    asn1_write_value (crl, "tbsCertList.issuer.rdnSequence.?LAST.?LAST.type",
+    asn1_internal_write_value (crl, "tbsCertList.issuer.rdnSequence.?LAST.?LAST.type",
 		      str, 1);
   result =
-    asn1_create_element (cert_def, "PKIX1Implicit88.X520countryName", &value);
-  result = asn1_write_value (value, "", "US", 2);
+    asn1_internal_create_element (cert_def, "PKIX1Implicit88.X520countryName", &value);
+  result = asn1_internal_write_value (value, "", "US", 2);
   *der_len = max_len;
-  result = asn1_der_coding (value, "", der, der_len, errorDescription);
+  result = asn1_internal_der_coding (value, "", der, der_len, errorDescription);
 
-  asn1_delete_structure (&value);
+  asn1_internal_delete_structure (&value);
   result =
-    asn1_write_value (crl, "tbsCertList.issuer.rdnSequence.?LAST.?LAST.value",
+    asn1_internal_write_value (crl, "tbsCertList.issuer.rdnSequence.?LAST.?LAST.value",
 		      der, *der_len);
 
 
-  result = asn1_write_value (crl, "tbsCertList.issuer.rdnSequence", "NEW", 4);
+  result = asn1_internal_write_value (crl, "tbsCertList.issuer.rdnSequence", "NEW", 4);
   result =
-    asn1_write_value (crl, "tbsCertList.issuer.rdnSequence.?LAST", "NEW", 4);
+    asn1_internal_write_value (crl, "tbsCertList.issuer.rdnSequence.?LAST", "NEW", 4);
   /* O */
   len = sizeof (str) - 1;
   result =
-    asn1_read_value (cert_def, "PKIX1Implicit88.id-at-organizationName", str,
+    asn1_internal_read_value (cert_def, "PKIX1Implicit88.id-at-organizationName", str,
 		     &len);
   result =
-    asn1_write_value (crl, "tbsCertList.issuer.rdnSequence.?LAST.?LAST.type",
+    asn1_internal_write_value (crl, "tbsCertList.issuer.rdnSequence.?LAST.?LAST.type",
 		      str, 8);
   result =
-    asn1_create_element (cert_def, "PKIX1Implicit88.X520OrganizationName",
-			 &value);
-  result = asn1_write_value (value, "", "printableString", 1);
-  result = asn1_write_value (value, "printableString", "gov", 3);
+    asn1_internal_create_element (cert_def, "PKIX1Implicit88.X520OrganizationName",
+				  &value);
+  result = asn1_internal_write_value (value, "", "printableString", 1);
+  result = asn1_internal_write_value (value, "printableString", "gov", 3);
   *der_len = max_len;
-  result = asn1_der_coding (value, "", der, der_len, errorDescription);
-  asn1_delete_structure (&value);
+  result = asn1_internal_der_coding (value, "", der, der_len, errorDescription);
+  asn1_internal_delete_structure (&value);
   result =
-    asn1_write_value (crl, "tbsCertList.issuer.rdnSequence.?LAST.?LAST.value",
+    asn1_internal_write_value (crl, "tbsCertList.issuer.rdnSequence.?LAST.?LAST.value",
 		      der, *der_len);
 
 
-  result = asn1_write_value (crl, "tbsCertList.issuer.rdnSequence", "NEW", 1);
+  result = asn1_internal_write_value (crl, "tbsCertList.issuer.rdnSequence", "NEW", 1);
   result =
-    asn1_write_value (crl, "tbsCertList.issuer.rdnSequence.?LAST", "NEW", 1);
+    asn1_internal_write_value (crl, "tbsCertList.issuer.rdnSequence.?LAST", "NEW", 1);
   /* OU */
   len = sizeof (str) - 1;
   result =
-    asn1_read_value (cert_def, "PKIX1Implicit88.id-at-organizationalUnitName",
+    asn1_internal_read_value (cert_def, "PKIX1Implicit88.id-at-organizationalUnitName",
 		     str, &len);
   result =
-    asn1_write_value (crl, "tbsCertList.issuer.rdnSequence.?LAST.?LAST.type",
+    asn1_internal_write_value (crl, "tbsCertList.issuer.rdnSequence.?LAST.?LAST.type",
 		      str, 1);
   result =
-    asn1_create_element (cert_def,
-			 "PKIX1Implicit88.X520OrganizationalUnitName",
-			 &value);
-  result = asn1_write_value (value, "", "printableString", 1);
-  result = asn1_write_value (value, "printableString", "nist", 4);
+    asn1_internal_create_element (cert_def,
+				  "PKIX1Implicit88.X520OrganizationalUnitName",
+				  &value);
+  result = asn1_internal_write_value (value, "", "printableString", 1);
+  result = asn1_internal_write_value (value, "printableString", "nist", 4);
   *der_len = max_len;
-  result = asn1_der_coding (value, "", der, der_len, errorDescription);
-  asn1_delete_structure (&value);
+  result = asn1_internal_der_coding (value, "", der, der_len, errorDescription);
+  asn1_internal_delete_structure (&value);
   result =
-    asn1_write_value (crl, "tbsCertList.issuer.rdnSequence.?LAST.?LAST.value",
+    asn1_internal_write_value (crl, "tbsCertList.issuer.rdnSequence.?LAST.?LAST.value",
 		      der, *der_len);
 
 
   /* validity */
-  result = asn1_write_value (crl, "tbsCertList.thisUpdate", "utcTime", 1);
+  result = asn1_internal_write_value (crl, "tbsCertList.thisUpdate", "utcTime", 1);
   result =
-    asn1_write_value (crl, "tbsCertList.thisUpdate.utcTime", "970801000000Z",
+    asn1_internal_write_value (crl, "tbsCertList.thisUpdate.utcTime", "970801000000Z",
 		      1);
 
-  result = asn1_write_value (crl, "tbsCertList.nextUpdate", "utcTime", 1);
+  result = asn1_internal_write_value (crl, "tbsCertList.nextUpdate", "utcTime", 1);
   result =
-    asn1_write_value (crl, "tbsCertList.nextUpdate.utcTime", "970808000000Z",
+    asn1_internal_write_value (crl, "tbsCertList.nextUpdate.utcTime", "970808000000Z",
 		      1);
 
 
   /* revokedCertificates */
   result =
-    asn1_write_value (crl, "tbsCertList.revokedCertificates", "NEW", 1);
+    asn1_internal_write_value (crl, "tbsCertList.revokedCertificates", "NEW", 1);
   str[0] = 18;
   result =
-    asn1_write_value (crl,
+    asn1_internal_write_value (crl,
 		      "tbsCertList.revokedCertificates.?LAST.userCertificate",
 		      str, 1);
   result =
-    asn1_write_value (crl,
+    asn1_internal_write_value (crl,
 		      "tbsCertList.revokedCertificates.?LAST.revocationDate",
 		      "utcTime", 1);
   result =
-    asn1_write_value (crl,
+    asn1_internal_write_value (crl,
 		      "tbsCertList.revokedCertificates.?LAST.revocationDate.utcTime",
 		      "970731000000Z", 1);
 
   result =
-    asn1_write_value (crl,
+    asn1_internal_write_value (crl,
 		      "tbsCertList.revokedCertificates.?LAST.crlEntryExtensions",
 		      "NEW", 1);
   len = sizeof (str) - 1;
-  result = asn1_read_value (cert_def, "PKIX1Implicit88.id-ce-cRLReasons",
+  result = asn1_internal_read_value (cert_def, "PKIX1Implicit88.id-ce-cRLReasons",
 			    str, &len);
-  result = asn1_write_value (crl, "tbsCertList.revokedCertificates.?LAST.crlEntryExtensions.?LAST.extnID", str, 1);	/* reasonCode */
+  result = asn1_internal_write_value (crl, "tbsCertList.revokedCertificates.?LAST.crlEntryExtensions.?LAST.extnID", str, 1);	/* reasonCode */
   result =
-    asn1_write_value (crl,
+    asn1_internal_write_value (crl,
 		      "tbsCertList.revokedCertificates.?LAST.crlEntryExtensions.?LAST.critical",
 		      "FALSE", 1);
   str2 = (const unsigned char *) "\x0a\x01\x01";
   result =
-    asn1_write_value (crl,
+    asn1_internal_write_value (crl,
 		      "tbsCertList.revokedCertificates.?LAST.crlEntryExtensions.?LAST.extnValue",
 		      str2, 3);
 
 
   /* crlExtensions */
-  result = asn1_write_value (crl, "tbsCertList.crlExtensions", NULL, 0);
+  result = asn1_internal_write_value (crl, "tbsCertList.crlExtensions", NULL, 0);
 
 
   /* signatureAlgorithm: dsa-with-sha  */
   len = sizeof (str) - 1;
   result =
-    asn1_read_value (cert_def, "PKIX1Implicit88.id-dsa-with-sha1", str, &len);
-  result = asn1_write_value (crl, "signatureAlgorithm.algorithm", str, 1);
-  result = asn1_write_value (crl, "signatureAlgorithm.parameters", NULL, 0);	/* NO OPTION */
+    asn1_internal_read_value (cert_def, "PKIX1Implicit88.id-dsa-with-sha1", str, &len);
+  result = asn1_internal_write_value (crl, "signatureAlgorithm.algorithm", str, 1);
+  result = asn1_internal_write_value (crl, "signatureAlgorithm.parameters", NULL, 0);	/* NO OPTION */
 
   /* signature */
   *der_len = max_len;
   result =
-    asn1_der_coding (crl, "tbsCertList", der, der_len, errorDescription);
+    asn1_internal_der_coding (crl, "tbsCertList", der, der_len, errorDescription);
   if (result != ASN1_SUCCESS)
     {
       printf ("\n'tbsCertList' encoding creation: ERROR\n");
@@ -398,7 +398,7 @@ create_CRL (ASN1_TYPE cert_def, unsigned char *der, int *der_len)
     }
 
   /* add the lines for the signature on der[0]..der[der_len-1]: result in str2 */
-  result = asn1_write_value (crl, "signature", str2, 46 * 8);
+  result = asn1_internal_write_value (crl, "signature", str2, 46 * 8);
 
 
   /* Use the next 3 lines to visit the certificate */
@@ -407,7 +407,7 @@ create_CRL (ASN1_TYPE cert_def, unsigned char *der, int *der_len)
      printf("-----------------\n"); */
 
   *der_len = max_len;
-  result = asn1_der_coding (crl, "", der, der_len, errorDescription);
+  result = asn1_internal_der_coding (crl, "", der, der_len, errorDescription);
   if (result != ASN1_SUCCESS)
     {
       printf ("\n'crl1' encoding creation: ERROR\n");
@@ -422,7 +422,7 @@ create_CRL (ASN1_TYPE cert_def, unsigned char *der, int *der_len)
   printf ("\n-----------------\n");
 
   /* Clear the "certificate1" structure */
-  asn1_delete_structure (&crl);
+  asn1_internal_delete_structure (&crl);
 }
 
 
@@ -445,9 +445,9 @@ get_CRL (ASN1_TYPE cert_def, unsigned char *der, int der_len)
   char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE];
 
 
-  asn1_create_element (cert_def, "PKIX1Implicit88.CertificateList", &crl2);
+  asn1_internal_create_element (cert_def, "PKIX1Implicit88.CertificateList", &crl2);
 
-  result = asn1_der_decoding (&crl2, der, der_len, errorDescription);
+  result = asn1_internal_der_decoding (&crl2, der, der_len, errorDescription);
 
   if (result != ASN1_SUCCESS)
     {
@@ -463,20 +463,20 @@ get_CRL (ASN1_TYPE cert_def, unsigned char *der, int der_len)
 
   /* Verify sign */
   len = sizeof (str) - 1;
-  result = asn1_read_value (crl2, "signatureAlgorithm.algorithm", str, &len);
+  result = asn1_internal_read_value (crl2, "signatureAlgorithm.algorithm", str, &len);
 
   result =
-    asn1_read_value (cert_def, "PKIX1Implicit88.id-dsa-with-sha1", str2,
+    asn1_internal_read_value (cert_def, "PKIX1Implicit88.id-dsa-with-sha1", str2,
 		     &len);
   if (!strcmp ((char *) str, (char *) str2))
     {				/* dsa-with-sha */
 
-      result = asn1_der_decoding_startEnd (crl2, der, der_len,
+      result = asn1_internal_der_decoding_startEnd (crl2, der, der_len,
 					   "tbsCertList", &start, &end);
 
       /* add the lines to calculate the sha on der[start]..der[end] */
 
-      result = asn1_read_value (crl2, "signature", str, &len);
+      result = asn1_internal_read_value (crl2, "signature", str, &len);
 
       /* compare the previous value to signature ( with issuer public key) */
     }
@@ -488,7 +488,7 @@ get_CRL (ASN1_TYPE cert_def, unsigned char *der, int der_len)
 
 
   /* Clear the "crl2" structure */
-  asn1_delete_structure (&crl2);
+  asn1_internal_delete_structure (&crl2);
 }
 
 extern const ASN1_ARRAY_TYPE pkix_asn1_tab[];
@@ -510,14 +510,14 @@ main (int argc, char *argv[])
 
   if (1)
     result =
-      asn1_array2tree (pkix_asn1_tab, &PKIX1Implicit88, errorDescription);
+      asn1_internal_array2tree (pkix_asn1_tab, &PKIX1Implicit88, errorDescription);
   else
     result =
-      asn1_parser2tree ("pkix.asn", &PKIX1Implicit88, errorDescription);
+      asn1_internal_parser2tree ("pkix.asn", &PKIX1Implicit88, errorDescription);
 
   if (result != ASN1_SUCCESS)
     {
-      asn1_perror (result);
+      asn1_internal_perror (result);
       printf ("%s\n", errorDescription);
       exit (1);
     }
@@ -534,7 +534,7 @@ main (int argc, char *argv[])
   get_CRL (PKIX1Implicit88, der, der_len);
 
   /* Clear the "PKIX1Implicit88" structures */
-  asn1_delete_structure (&PKIX1Implicit88);
+  asn1_internal_delete_structure (&PKIX1Implicit88);
 
   return 0;
 }
diff --git a/examples/pkix_asn1_tab.c b/examples/pkix_asn1_tab.c
index b65f622..679cca5 100644
--- a/examples/pkix_asn1_tab.c
+++ b/examples/pkix_asn1_tab.c
@@ -2,7 +2,7 @@
 # include "config.h"
 #endif
 
-#include <libtasn1.h>
+#include <libtasn1-internal.h>
 
 const asn1_static_node pkix_asn1_tab[] = {
   { "PKIX1Implicit88", 536875024, NULL },
diff --git a/lib/ASN1.y b/lib/ASN1.y
index 731415d..53a6b88 100644
--- a/lib/ASN1.y
+++ b/lib/ASN1.y
@@ -30,7 +30,7 @@
 #include <int.h>
 #include <parser_aux.h>
 #include <structure.h>
-#include <libtasn1.h>
+#include <libtasn1-internal.h>
 
 static FILE *file_asn1;			/* Pointer to file to parse */
 static int result_parse = 0;	/* result of the parser
@@ -657,8 +657,8 @@ _asn1_create_errorDescription (int error, char *error_desc)
  *   characters.
  **/
 int
-asn1_parser2tree (const char *file, asn1_node * definitions,
-                  char *error_desc)
+asn1_internal_parser2tree (const char *file, asn1_node * definitions,
+			   char *error_desc)
 {
 
   p_tree = NULL;
@@ -745,8 +745,8 @@ asn1_parser2tree (const char *file, asn1_node * definitions,
  *   characters.
  **/
 int
-asn1_parser2array (const char *inputFileName, const char *outputFileName,
-                   const char *vectorName, char *error_desc)
+asn1_internal_parser2array (const char *inputFileName, const char *outputFileName,
+			    const char *vectorName, char *error_desc)
 {
   char *file_out_name = NULL;
   char *vector_name = NULL;
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 8b6a0f0..3e8c37d 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -28,22 +28,23 @@ pkgconfig_DATA = libtasn1.pc
 
 lib_LTLIBRARIES = libtasn1.la
 
-libtasn1_la_SOURCES =	\
-	ASN1.y		\
-	coding.c	\
-	decoding.c	\
-	element.c	\
-	element.h	\
-	errors.c	\
-	gstr.c		\
-	gstr.h		\
-	int.h		\
-	libtasn1.h	\
-	libtasn1.map	\
-	parser_aux.c	\
-	parser_aux.h	\
-	structure.c	\
-	structure.h	\
+libtasn1_la_SOURCES =				\
+	ASN1.y					\
+	coding.c				\
+	compat-wrapper.c			\
+	decoding.c				\
+	element.c				\
+	element.h				\
+	errors.c				\
+	gstr.c					\
+	gstr.h					\
+	int.h					\
+	libtasn1.h				\
+	libtasn1.map				\
+	parser_aux.c				\
+	parser_aux.h				\
+	structure.c				\
+	structure.h				\
 	version.c
 
 libtasn1_la_LIBADD = gllib/libgnu.la
diff --git a/lib/coding.c b/lib/coding.c
index d6b7cf4..23ad4fb 100644
--- a/lib/coding.c
+++ b/lib/coding.c
@@ -72,7 +72,7 @@ _asn1_error_description_value_not_found (asn1_node node,
  * To know the size of the DER encoding use a %NULL value for @der.
  **/
 void
-asn1_length_der (unsigned long int len, unsigned char *der, int *der_len)
+asn1_internal_length_der (unsigned long int len, unsigned char *der, int *der_len)
 {
   int k;
   unsigned char temp[ASN1_MAX_LENGTH_SIZE];
@@ -170,15 +170,15 @@ _asn1_tag_der (unsigned char class, unsigned int tag_value,
  * asn1_length_der().
  **/
 void
-asn1_octet_der (const unsigned char *str, int str_len,
-		unsigned char *der, int *der_len)
+asn1_internal_octet_der (const unsigned char *str, int str_len,
+			 unsigned char *der, int *der_len)
 {
   int len_len;
 
   if (der == NULL || str_len < 0)
     return;
 
-  asn1_length_der (str_len, der, &len_len);
+  asn1_internal_length_der (str_len, der, &len_len);
   memcpy (der + len_len, str, str_len);
   *der_len = str_len + len_len;
 }
@@ -202,9 +202,9 @@ asn1_octet_der (const unsigned char *str, int str_len,
  * Returns: %ASN1_SUCCESS if successful or an error value.
  **/
 int
-asn1_encode_simple_der (unsigned int etype, const unsigned char *str,
-			unsigned int str_len, unsigned char *tl,
-			unsigned int *tl_len)
+asn1_internal_encode_simple_der (unsigned int etype, const unsigned char *str,
+				 unsigned int str_len, unsigned char *tl,
+				 unsigned int *tl_len)
 {
   int tag_len, len_len;
   unsigned tlen;
@@ -224,7 +224,7 @@ asn1_encode_simple_der (unsigned int etype, const unsigned char *str,
 
   _asn1_tag_der (ETYPE_CLASS (etype), ETYPE_TAG (etype), der_tag, &tag_len);
 
-  asn1_length_der (str_len, der_length, &len_len);
+  asn1_internal_length_der (str_len, der_length, &len_len);
 
   if (tag_len <= 0 || len_len <= 0)
     return ASN1_VALUE_NOT_VALID;
@@ -267,7 +267,7 @@ _asn1_time_der (unsigned char *str, int str_len, unsigned char *der,
 
   max_len = *der_len;
 
-  asn1_length_der (str_len, (max_len > 0) ? der : NULL, &len_len);
+  asn1_internal_length_der (str_len, (max_len > 0) ? der : NULL, &len_len);
 
   if ((len_len + str_len) <= max_len)
     memcpy (der + len_len, str, str_len);
@@ -288,7 +288,7 @@ _asn1_get_utctime_der(unsigned char *der,int *der_len,unsigned char *str)
   char temp[20];
 
   if(str==NULL) return;
-  str_len=asn1_get_length_der(der,*der_len,&len_len);
+  str_len=asn1_internal_get_length_der(der,*der_len,&len_len);
   if (str_len<0) return;
   memcpy(temp,der+len_len,str_len);
   *der_len=str_len+len_len;
@@ -387,11 +387,11 @@ _asn1_objectid_der (unsigned char *str, unsigned char *der, int *der_len)
       n_start = n_end + 1;
     }
 
-  asn1_length_der (*der_len, NULL, &len_len);
+  asn1_internal_length_der (*der_len, NULL, &len_len);
   if (max_len >= (*der_len + len_len))
     {
       memmove (der + len_len, der, *der_len);
-      asn1_length_der (*der_len, der, &len_len);
+      asn1_internal_length_der (*der_len, der, &len_len);
     }
   *der_len += len_len;
 
@@ -427,8 +427,8 @@ static const unsigned char bit_mask[] =
  * asn1_length_der().
  **/
 void
-asn1_bit_der (const unsigned char *str, int bit_len,
-	      unsigned char *der, int *der_len)
+asn1_internal_bit_der (const unsigned char *str, int bit_len,
+		       unsigned char *der, int *der_len)
 {
   int len_len, len_byte, len_pad;
 
@@ -441,7 +441,7 @@ asn1_bit_der (const unsigned char *str, int bit_len,
     len_pad = 0;
   else
     len_byte++;
-  asn1_length_der (len_byte + 1, der, &len_len);
+  asn1_internal_length_der (len_byte + 1, der, &len_len);
   der[len_len] = len_pad;
   memcpy (der + len_len + 1, str, len_byte);
   der[len_len + len_byte] &= bit_mask[len_pad];
@@ -493,7 +493,7 @@ _asn1_complete_explicit_tag (asn1_node node, unsigned char *der,
 		{
 		  len2 = strtol (p->name, NULL, 10);
 		  _asn1_set_name (p, NULL);
-		  asn1_length_der (*counter - len2, temp, &len3);
+		  asn1_internal_length_der (*counter - len2, temp, &len3);
 		  if (len3 <= (*max_len))
 		    {
 		      memmove (der + len2 + len3, der + len2,
@@ -749,7 +749,7 @@ _asn1_ordering_set (unsigned char *der, int der_len, asn1_node node)
       last = p_vet;
 
       /* tag value calculation */
-      err = asn1_get_tag_der (der + counter, der_len - counter, &class, &len2,
+      err = asn1_internal_get_tag_der (der + counter, der_len - counter, &class, &len2,
 			      &tag);
       if (err != ASN1_SUCCESS)
 	goto error;
@@ -759,7 +759,7 @@ _asn1_ordering_set (unsigned char *der, int der_len, asn1_node node)
       counter += len2;
 
       /* extraction and length */
-      len2 = asn1_get_length_der (der + counter, der_len - counter, &len);
+      len2 = asn1_internal_get_length_der (der + counter, der_len - counter, &len);
       if (len2 < 0)
 	{
 	  err = ASN1_DER_ERROR;
@@ -892,13 +892,13 @@ _asn1_ordering_set_of (unsigned char *der, int der_len, asn1_node node)
       if (der_len - counter > 0)
 	{
 
-	  err = asn1_get_tag_der (der + counter, der_len - counter, &class,
+	  err = asn1_internal_get_tag_der (der + counter, der_len - counter, &class,
 	                          &len, NULL);
 	  if (err != ASN1_SUCCESS)
 	    goto error;
 	  counter += len;
 
-	  len2 = asn1_get_length_der (der + counter, der_len - counter, &len);
+	  len2 = asn1_internal_get_length_der (der + counter, der_len - counter, &len);
 	  if (len2 < 0)
 	    {
 	      err = ASN1_DER_ERROR;
@@ -1008,8 +1008,8 @@ error:
  *   length needed.
  **/
 int
-asn1_der_coding (asn1_node element, const char *name, void *ider, int *len,
-		 char *ErrorDescription)
+asn1_internal_der_coding (asn1_node element, const char *name, void *ider, int *len,
+			  char *ErrorDescription)
 {
   asn1_node node, p, p2;
   unsigned char temp[MAX(LTOSTR_MAX_SIZE, SIZEOF_UNSIGNED_LONG_INT * 3 + 1)];
@@ -1017,7 +1017,7 @@ asn1_der_coding (asn1_node element, const char *name, void *ider, int *len,
   int err;
   unsigned char *der = ider;
 
-  node = asn1_find_node (element, name);
+  node = asn1_internal_find_node (element, name);
   if (node == NULL)
     return ASN1_ELEMENT_NOT_FOUND;
 
@@ -1099,7 +1099,7 @@ asn1_der_coding (asn1_node element, const char *name, void *ider, int *len,
 		  err = ASN1_VALUE_NOT_FOUND;
 		  goto error;
 		}
-	      len2 = asn1_get_length_der (p->value, p->value_len, &len3);
+	      len2 = asn1_internal_get_length_der (p->value, p->value_len, &len3);
 	      if (len2 < 0)
 		{
 		  err = ASN1_DER_ERROR;
@@ -1171,7 +1171,7 @@ asn1_der_coding (asn1_node element, const char *name, void *ider, int *len,
 	      err = ASN1_VALUE_NOT_FOUND;
 	      goto error;
 	    }
-	  len2 = asn1_get_length_der (p->value, p->value_len, &len3);
+	  len2 = asn1_internal_get_length_der (p->value, p->value_len, &len3);
 	  if (len2 < 0)
 	    {
 	      err = ASN1_DER_ERROR;
@@ -1221,7 +1221,7 @@ asn1_der_coding (asn1_node element, const char *name, void *ider, int *len,
 		  if (err != ASN1_SUCCESS)
 		    goto error;
 		}
-	      asn1_length_der (counter - len2, temp, &len3);
+	      asn1_internal_length_der (counter - len2, temp, &len3);
 	      max_len -= len3;
 	      if (max_len >= 0)
 		{
@@ -1266,7 +1266,7 @@ asn1_der_coding (asn1_node element, const char *name, void *ider, int *len,
 		  if (err != ASN1_SUCCESS)
 		    goto error;
 		}
-	      asn1_length_der (counter - len2, temp, &len3);
+	      asn1_internal_length_der (counter - len2, temp, &len3);
 	      max_len -= len3;
 	      if (max_len >= 0)
 		{
@@ -1284,7 +1284,7 @@ asn1_der_coding (asn1_node element, const char *name, void *ider, int *len,
 	      err = ASN1_VALUE_NOT_FOUND;
 	      goto error;
 	    }
-	  len2 = asn1_get_length_der (p->value, p->value_len, &len3);
+	  len2 = asn1_internal_get_length_der (p->value, p->value_len, &len3);
 	  if (len2 < 0)
 	    {
 	      err = ASN1_DER_ERROR;
@@ -1340,6 +1340,6 @@ asn1_der_coding (asn1_node element, const char *name, void *ider, int *len,
   err = ASN1_SUCCESS;
 
 error:
-  asn1_delete_structure (&node);
+  asn1_internal_delete_structure (&node);
   return err;
 }
diff --git a/lib/compat-wrapper.c b/lib/compat-wrapper.c
new file mode 100644
index 0000000..1d3b24d
--- /dev/null
+++ b/lib/compat-wrapper.c
@@ -0,0 +1,263 @@
+#include <config.h>
+#include <string.h>
+
+#define LIBTASN1_COMPAT_WRAPPER
+#include "libtasn1-internal.h"
+
+#include "libtasn1.h"
+
+asn1_retCode
+asn1_parser2tree (const char *file_name,
+		  ASN1_TYPE  *definitions,
+		  char       *errorDescription)
+{
+	return asn1_internal_parser2tree (file_name, definitions, errorDescription);
+}
+
+asn1_retCode
+asn1_parser2array (const char *inputFileName,
+		   const char *outputFileName,
+		   const char *vectorName,
+		   char       *errorDescription)
+{
+	return asn1_internal_parser2array (inputFileName, outputFileName, vectorName, errorDescription);
+}
+
+asn1_retCode
+asn1_array2tree (const ASN1_ARRAY_TYPE * array,
+		 ASN1_TYPE * definitions,
+		 char *errorDescription)
+{
+	return asn1_internal_array2tree (array, definitions, errorDescription);
+}
+
+void
+asn1_print_structure (FILE       *out,
+		      ASN1_TYPE   structure,
+		      const char *name,
+		      int         mode)
+{
+	asn1_internal_print_structure (out, structure, name, mode);
+}
+
+asn1_retCode
+asn1_create_element (ASN1_TYPE   definitions,
+		     const char *source_name,
+		     ASN1_TYPE  *element)
+{
+	return asn1_internal_create_element (definitions, source_name, element);
+}
+
+asn1_retCode
+asn1_delete_structure (ASN1_TYPE *structure)
+{
+	return asn1_internal_delete_structure (structure);
+}
+
+asn1_retCode
+asn1_delete_element (ASN1_TYPE   structure,
+		     const char *element_name)
+{
+	return asn1_internal_delete_element (structure, element_name);
+}
+
+asn1_retCode
+asn1_write_value (ASN1_TYPE   node_root,
+		  const char *name,
+		  const void *ivalue,
+		  int         len)
+{
+	return asn1_internal_write_value (node_root, name, ivalue, len);
+}
+
+asn1_retCode
+asn1_read_value (ASN1_TYPE   root,
+		 const char *name,
+		 void       *ivalue,
+		 int        *len)
+{
+	return asn1_internal_read_value (root, name, ivalue, len);
+}
+
+asn1_retCode
+asn1_number_of_elements (ASN1_TYPE   element,
+			 const char *name,
+			 int        *num)
+{
+	return asn1_internal_number_of_elements (element, name, num);
+}
+
+asn1_retCode
+asn1_der_coding (ASN1_TYPE   element,
+		 const char *name,
+		 void       *ider,
+		 int        *len,
+		 char       *ErrorDescription)
+{
+	return asn1_internal_der_coding (element, name, ider, len, ErrorDescription);
+}
+
+asn1_retCode
+asn1_der_decoding (ASN1_TYPE  *element,
+		   const void *ider,
+		   int         len,
+		   char       *errorDescription)
+{
+	return asn1_internal_der_decoding (element, ider, len, errorDescription);
+}
+
+asn1_retCode
+asn1_der_decoding_element (ASN1_TYPE  *structure,
+			   const char *elementName,
+			   const void *ider,
+			   int         len,
+			   char       *errorDescription)
+{
+	return asn1_internal_der_decoding_element (structure, elementName, ider, len, errorDescription);
+}
+
+asn1_retCode
+asn1_der_decoding_startEnd (ASN1_TYPE   element,
+			    const void *ider,
+			    int         len,
+			    const char *name_element,
+			    int        *start,
+			    int        *end)
+{
+	return asn1_internal_der_decoding_startEnd (element, ider, len, name_element, start, end);
+}
+
+asn1_retCode
+asn1_expand_any_defined_by (ASN1_TYPE  definitions,
+			    ASN1_TYPE *element)
+{
+	return asn1_internal_expand_any_defined_by (definitions, element);
+}
+
+asn1_retCode
+asn1_expand_octet_string (ASN1_TYPE   definitions,
+			  ASN1_TYPE  *element,
+			  const char *octetName,
+			  const char *objectName)
+{
+	return asn1_internal_expand_octet_string (definitions, element, octetName, objectName);
+}
+
+asn1_retCode
+asn1_read_tag (node_asn   *root,
+	       const char *name,
+	       int        *tagValue,
+	       int        *classValue)
+{
+	return asn1_internal_read_tag (root, name, tagValue, classValue);
+}
+
+const char *
+asn1_find_structure_from_oid (ASN1_TYPE   definitions,
+			      const char *oidValue)
+{
+	return asn1_internal_find_structure_from_oid (definitions, oidValue);
+}
+
+const char *
+asn1_check_version (const char *req_version)
+{
+	if (!req_version || strverscmp (req_version, LIBTASN1_VERSION) <= 0)
+		return LIBTASN1_VERSION;
+
+	return NULL;
+}
+
+const char *
+libtasn1_strerror (asn1_retCode error)
+{
+	return asn1_internal_strerror (error);
+}
+
+void
+libtasn1_perror (asn1_retCode error)
+{
+	asn1_internal_perror (error);
+}
+
+int
+asn1_get_tag_der (const unsigned char *der,
+		  int                  der_len,
+		  unsigned char       *cls,
+		  int                 *len,
+		  unsigned long       *tag)
+{
+	return asn1_internal_get_tag_der (der, der_len, cls, len, tag);
+}
+
+void
+asn1_octet_der (const unsigned char *str,
+		int                  str_len,
+		unsigned char       *der,
+		int                 *der_len)
+{
+	asn1_internal_octet_der (str, str_len, der, der_len);
+}
+
+asn1_retCode
+asn1_get_octet_der (const unsigned char *der,
+		    int			 der_len,
+		    int			*ret_len,
+		    unsigned char	*str,
+		    int			 str_size,
+		    int			*str_len)
+{
+	return asn1_internal_get_octet_der (der, der_len, ret_len, str, str_size, str_len);
+}
+
+void
+asn1_bit_der (const unsigned char *str,
+	      int		   bit_len,
+	      unsigned char	  *der,
+	      int		  *der_len)
+{
+	asn1_internal_bit_der (str, bit_len, der, der_len);
+}
+
+asn1_retCode
+asn1_get_bit_der (const unsigned char *der,
+		  int		       der_len,
+		  int		      *ret_len,
+		  unsigned char	      *str,
+		  int		       str_size,
+		  int		      *bit_len)
+{
+	return asn1_internal_get_bit_der (der, der_len, ret_len, str, str_size, bit_len);
+}
+
+signed long
+asn1_get_length_der (const unsigned char *der,
+		     int		  der_len,
+		     int		 *len)
+{
+	return asn1_internal_get_length_der (der, der_len, len);
+}
+
+void
+asn1_length_der (unsigned long int  len,
+		 unsigned char     *ans,
+		 int               *ans_len)
+{
+	asn1_internal_length_der (len, ans, ans_len);
+}
+
+ASN1_TYPE
+asn1_find_node (ASN1_TYPE   pointer,
+		const char *name)
+{
+	return asn1_internal_find_node (pointer, name);
+}
+
+asn1_retCode
+asn1_copy_node (ASN1_TYPE   dst,
+		const char *dst_name,
+		ASN1_TYPE   src,
+		const char *src_name)
+{
+	return asn1_internal_copy_node (dst, dst_name, src, src_name);
+}
diff --git a/lib/decoding.c b/lib/decoding.c
index 53bd910..c452496 100644
--- a/lib/decoding.c
+++ b/lib/decoding.c
@@ -77,7 +77,7 @@ _asn1_error_description_tag_error (asn1_node node, char *ErrorDescription)
  *   when the decoded length value plus @len would exceed @der_len.
  **/
 long
-asn1_get_length_der (const unsigned char *der, int der_len, int *len)
+asn1_internal_get_length_der (const unsigned char *der, int der_len, int *len)
 {
   unsigned int ans;
   int k, punt, sum;
@@ -145,8 +145,8 @@ asn1_get_length_der (const unsigned char *der, int der_len, int *len)
  * Returns: Returns %ASN1_SUCCESS on success, or an error.
  **/
 int
-asn1_get_tag_der (const unsigned char *der, int der_len,
-		  unsigned char *cls, int *len, unsigned long *tag)
+asn1_internal_get_tag_der (const unsigned char *der, int der_len,
+			   unsigned char *cls, int *len, unsigned long *tag)
 {
   unsigned int ris;
   int punt;
@@ -215,12 +215,12 @@ asn1_get_tag_der (const unsigned char *der, int der_len,
  * Since: 2.0
  **/
 long
-asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len)
+asn1_internal_get_length_ber (const unsigned char *ber, int ber_len, int *len)
 {
   int ret;
   long err;
 
-  ret = asn1_get_length_der (ber, ber_len, len);
+  ret = asn1_internal_get_length_der (ber, ber_len, len);
   if (ret == -1)
     {				/* indefinite length method */
       err = _asn1_get_indefinite_length_string (ber + 1, ber_len, &ret);
@@ -245,16 +245,16 @@ asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len)
  * Returns: Returns %ASN1_SUCCESS on success, or an error.
  **/
 int
-asn1_get_octet_der (const unsigned char *der, int der_len,
-		    int *ret_len, unsigned char *str, int str_size,
-		    int *str_len)
+asn1_internal_get_octet_der (const unsigned char *der, int der_len,
+			     int *ret_len, unsigned char *str, int str_size,
+			     int *str_len)
 {
   int len_len = 0;
 
   if (der_len <= 0)
     return ASN1_GENERIC_ERROR;
 
-  *str_len = asn1_get_length_der (der, der_len, &len_len);
+  *str_len = asn1_internal_get_length_der (der, der_len, &len_len);
 
   if (*str_len < 0)
     return ASN1_DER_ERROR;
@@ -284,7 +284,7 @@ _asn1_get_time_der (const unsigned char *der, int der_len, int *ret_len,
   if (der_len <= 0 || str == NULL)
     return ASN1_DER_ERROR;
 
-  str_len = asn1_get_length_der (der, der_len, &len_len);
+  str_len = asn1_internal_get_length_der (der, der_len, &len_len);
   if (str_len <= 0 || str_size < str_len)
     return ASN1_DER_ERROR;
 
@@ -311,7 +311,7 @@ _asn1_get_objectid_der (const unsigned char *der, int der_len, int *ret_len,
   if (str == NULL || der_len <= 0)
     return ASN1_GENERIC_ERROR;
 
-  len = asn1_get_length_der (der, der_len, &len_len);
+  len = asn1_internal_get_length_der (der, der_len, &len_len);
 
   if (len <= 0 || len + len_len > der_len)
     return ASN1_DER_ERROR;
@@ -371,16 +371,16 @@ _asn1_get_objectid_der (const unsigned char *der, int der_len, int *ret_len,
  * Returns: Return %ASN1_SUCCESS on success, or an error.
  **/
 int
-asn1_get_bit_der (const unsigned char *der, int der_len,
-		  int *ret_len, unsigned char *str, int str_size,
-		  int *bit_len)
+asn1_internal_get_bit_der (const unsigned char *der, int der_len,
+			   int *ret_len, unsigned char *str, int str_size,
+			   int *bit_len)
 {
   int len_len = 0, len_byte;
 
   if (der_len <= 0)
     return ASN1_GENERIC_ERROR;
 
-  len_byte = asn1_get_length_der (der, der_len, &len_len) - 1;
+  len_byte = asn1_internal_get_length_der (der, der_len, &len_len) - 1;
   if (len_byte < 0)
     return ASN1_DER_ERROR;
 
@@ -437,7 +437,7 @@ _asn1_extract_tag_der (asn1_node node, const unsigned char *der, int der_len,
 
 	      if (p->type & CONST_EXPLICIT)
 		{
-		  if (asn1_get_tag_der
+		  if (asn1_internal_get_tag_der
 		      (der + counter, der_len, &class, &len2,
 		       &tag) != ASN1_SUCCESS)
 		    return ASN1_DER_ERROR;
@@ -446,7 +446,7 @@ _asn1_extract_tag_der (asn1_node node, const unsigned char *der, int der_len,
 		  counter += len2;
 
 		  len3 =
-		    asn1_get_length_ber (der + counter, der_len,
+		    asn1_internal_get_length_ber (der + counter, der_len,
 					 &len2);
 		  if (len3 < 0)
 		    return ASN1_DER_ERROR;
@@ -488,7 +488,7 @@ _asn1_extract_tag_der (asn1_node node, const unsigned char *der, int der_len,
 
   if (is_tag_implicit)
     {
-      if (asn1_get_tag_der
+      if (asn1_internal_get_tag_der
 	  (der + counter, der_len, &class, &len2,
 	   &tag) != ASN1_SUCCESS)
 	return ASN1_DER_ERROR;
@@ -516,7 +516,7 @@ _asn1_extract_tag_der (asn1_node node, const unsigned char *der, int der_len,
 	  return ASN1_SUCCESS;
 	}
 
-      if (asn1_get_tag_der
+      if (asn1_internal_get_tag_der
 	  (der + counter, der_len, &class, &len2,
 	   &tag) != ASN1_SUCCESS)
 	return ASN1_DER_ERROR;
@@ -624,7 +624,7 @@ _asn1_delete_not_used (asn1_node node)
 	      if (!p2)
 		p2 = _asn1_find_up (p);
 	    }
-	  asn1_delete_structure (&p);
+	  asn1_internal_delete_structure (&p);
 	  p = p2;
 	}
 
@@ -671,7 +671,7 @@ _asn1_extract_der_octet (asn1_node node, const unsigned char *der,
   int counter, counter_end;
   int result;
 
-  len2 = asn1_get_length_der (der, der_len, &len3);
+  len2 = asn1_internal_get_length_der (der, der_len, &len3);
   if (len2 < -1)
     return ASN1_DER_ERROR;
 
@@ -684,7 +684,7 @@ _asn1_extract_der_octet (asn1_node node, const unsigned char *der,
 
   while (counter < counter_end)
     {
-      len2 = asn1_get_length_der (der + counter, der_len, &len3);
+      len2 = asn1_internal_get_length_der (der + counter, der_len, &len3);
 
       if (len2 < -1)
 	return ASN1_DER_ERROR;
@@ -726,7 +726,7 @@ _asn1_get_octet_string (asn1_node node, const unsigned char *der, int der_len, i
   if (*(der - 1) & ASN1_CLASS_STRUCTURED)
     {
       tot_len = 0;
-      indefinite = asn1_get_length_der (der, der_len, &len3);
+      indefinite = asn1_internal_get_length_der (der, der_len, &len3);
       if (indefinite < -1)
 	return ASN1_DER_ERROR;
 
@@ -759,7 +759,7 @@ _asn1_get_octet_string (asn1_node node, const unsigned char *der, int der_len, i
 
 	  counter++;
 
-	  len2 = asn1_get_length_der (der + counter, der_len, &len3);
+	  len2 = asn1_internal_get_length_der (der + counter, der_len, &len3);
 	  if (len2 <= 0)
 	    return ASN1_DER_ERROR;
 
@@ -777,7 +777,7 @@ _asn1_get_octet_string (asn1_node node, const unsigned char *der, int der_len, i
 
 	  len2 = sizeof (temp);
 
-	  asn1_length_der (tot_len, temp, &len2);
+	  asn1_internal_length_der (tot_len, temp, &len2);
 	  _asn1_set_value (node, temp, len2);
 
 	  ret = _asn1_extract_der_octet (node, der, der_len);
@@ -788,7 +788,7 @@ _asn1_get_octet_string (asn1_node node, const unsigned char *der, int der_len, i
     }
   else
     {				/* NOT STRUCTURED */
-      len2 = asn1_get_length_der (der, der_len, &len3);
+      len2 = asn1_internal_get_length_der (der, der_len, &len3);
       if (len2 < 0)
 	return ASN1_DER_ERROR;
 
@@ -830,7 +830,7 @@ _asn1_get_indefinite_length_string (const unsigned char *der,
 	    continue;
 	}
 
-      if (asn1_get_tag_der
+      if (asn1_internal_get_tag_der
 	  (der + counter, der_len, &class, &len2,
 	   &tag) != ASN1_SUCCESS)
 	return ASN1_DER_ERROR;
@@ -838,7 +838,7 @@ _asn1_get_indefinite_length_string (const unsigned char *der,
       DECR_LEN(der_len, len2);
       counter += len2;
 
-      len2 = asn1_get_length_der (der + counter, der_len, &len3);
+      len2 = asn1_internal_get_length_der (der + counter, der_len, &len3);
       if (len2 < -1)
 	return ASN1_DER_ERROR;
 
@@ -869,7 +869,7 @@ static void delete_unneeded_choice_fields(asn1_node p)
   while (p->right)
     {
       p2 = p->right;
-      asn1_delete_structure (&p2);
+      asn1_internal_delete_structure (&p2);
     }
 }
 
@@ -895,7 +895,7 @@ static void delete_unneeded_choice_fields(asn1_node p)
  *   name (*@ELEMENT deleted).
  **/
 int
-asn1_der_decoding (asn1_node * element, const void *ider, int ider_len,
+asn1_internal_der_decoding (asn1_node * element, const void *ider, int ider_len,
 		   char *errorDescription)
 {
   asn1_node node, p, p2, p3;
@@ -996,7 +996,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, int ider_len,
 		    move = UP;
 
 		  if (p->type & CONST_OPTION)
-		    asn1_delete_structure (&p);
+		    asn1_internal_delete_structure (&p);
 
 		  p = p2;
 		  continue;
@@ -1025,7 +1025,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, int ider_len,
 		  else
 		    {
 		      p2 = p->down;
-		      asn1_delete_structure (&p2);
+		      asn1_internal_delete_structure (&p2);
 		    }
 		}
 
@@ -1117,7 +1117,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, int ider_len,
 	    case ASN1_ETYPE_INTEGER:
 	    case ASN1_ETYPE_ENUMERATED:
 	      len2 =
-		asn1_get_length_der (der + counter, ider_len, &len3);
+		asn1_internal_get_length_der (der + counter, ider_len, &len3);
 	      if (len2 < 0)
 		{
 		  result = ASN1_DER_ERROR;
@@ -1193,7 +1193,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, int ider_len,
 	    case ASN1_ETYPE_VISIBLE_STRING:
 	    case ASN1_ETYPE_BIT_STRING:
 	      len2 =
-		asn1_get_length_der (der + counter, ider_len, &len3);
+		asn1_internal_get_length_der (der + counter, ider_len, &len3);
 	      if (len2 < 0)
 		{
 		  result = ASN1_DER_ERROR;
@@ -1238,7 +1238,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, int ider_len,
 	      else
 		{		/* move==DOWN || move==RIGHT */
 		  len3 =
-		    asn1_get_length_der (der + counter, ider_len, &len2);
+		    asn1_internal_get_length_der (der + counter, ider_len, &len2);
 		  if (len3 < -1)
 		    {
 		      result = ASN1_DER_ERROR;
@@ -1265,7 +1265,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, int ider_len,
 			  if (type_field (p2->type) != ASN1_ETYPE_TAG)
 			    {
 			      p3 = p2->right;
-			      asn1_delete_structure (&p2);
+			      asn1_internal_delete_structure (&p2);
 			      p2 = p3;
 			    }
 			  else
@@ -1325,7 +1325,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, int ider_len,
 	      else
 		{		/* move==DOWN || move==RIGHT */
 		  len3 =
-		    asn1_get_length_der (der + counter, ider_len, &len2);
+		    asn1_internal_get_length_der (der + counter, ider_len, &len2);
 		  if (len3 < -1)
 		    {
 		      result = ASN1_DER_ERROR;
@@ -1361,7 +1361,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, int ider_len,
 	      move = RIGHT;
 	      break;
 	    case ASN1_ETYPE_ANY:
-	      if (asn1_get_tag_der
+	      if (asn1_internal_get_tag_der
 		  (der + counter, ider_len, &class, &len2,
 		   &tag) != ASN1_SUCCESS)
 		{
@@ -1373,7 +1373,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, int ider_len,
 	      DECR_LEN(ider_len, len2);
 
 	      len4 =
-		asn1_get_length_der (der + counter + len2,
+		asn1_internal_get_length_der (der + counter + len2,
 				     ider_len, &len3);
 	      if (len4 < -1)
 		{
@@ -1476,7 +1476,7 @@ asn1_der_decoding (asn1_node * element, const void *ider, int ider_len,
   return ASN1_SUCCESS;
 
 cleanup:
-  asn1_delete_structure (element);
+  asn1_internal_delete_structure (element);
   return result;
 }
 
@@ -1510,7 +1510,7 @@ cleanup:
  *   match the structure @structure (*ELEMENT deleted).
  **/
 int
-asn1_der_decoding_element (asn1_node * structure, const char *elementName,
+asn1_internal_der_decoding_element (asn1_node * structure, const char *elementName,
 			   const void *ider, int len, char *errorDescription)
 {
   asn1_node node, p, p2, p3, nodeFound = NULL;
@@ -1637,7 +1637,7 @@ asn1_der_decoding_element (asn1_node * structure, const char *elementName,
 		    move = UP;
 
 		  if (p->type & CONST_OPTION)
-		    asn1_delete_structure (&p);
+		    asn1_internal_delete_structure (&p);
 
 		  p = p2;
 		  continue;
@@ -1667,7 +1667,7 @@ asn1_der_decoding_element (asn1_node * structure, const char *elementName,
 		  else
 		    {
 		      p2 = p->down;
-		      asn1_delete_structure (&p2);
+		      asn1_internal_delete_structure (&p2);
 		    }
 		}
 
@@ -1762,7 +1762,7 @@ asn1_der_decoding_element (asn1_node * structure, const char *elementName,
 	    case ASN1_ETYPE_INTEGER:
 	    case ASN1_ETYPE_ENUMERATED:
 	      len2 =
-		asn1_get_length_der (der + counter, len - counter, &len3);
+		asn1_internal_get_length_der (der + counter, len - counter, &len3);
 	      if (len2 < 0)
 		{
 		  result = ASN1_DER_ERROR;
@@ -1804,7 +1804,7 @@ asn1_der_decoding_element (asn1_node * structure, const char *elementName,
 	      else
 		{
 		  len2 =
-		    asn1_get_length_der (der + counter, len - counter, &len3);
+		    asn1_internal_get_length_der (der + counter, len - counter, &len3);
 		  if (len2 < 0)
 		    {
 		      result = ASN1_DER_ERROR;
@@ -1836,7 +1836,7 @@ asn1_der_decoding_element (asn1_node * structure, const char *elementName,
 	      else
 		{
 		  len2 =
-		    asn1_get_length_der (der + counter, len - counter, &len3);
+		    asn1_internal_get_length_der (der + counter, len - counter, &len3);
 		  if (len2 < 0)
 		    {
 		      result = ASN1_DER_ERROR;
@@ -1875,7 +1875,7 @@ asn1_der_decoding_element (asn1_node * structure, const char *elementName,
 	    case ASN1_ETYPE_VISIBLE_STRING:
 	    case ASN1_ETYPE_BIT_STRING:
 	      len2 =
-		asn1_get_length_der (der + counter, len - counter, &len3);
+		asn1_internal_get_length_der (der + counter, len - counter, &len3);
 	      if (len2 < 0)
 		{
 		  result = ASN1_DER_ERROR;
@@ -1929,7 +1929,7 @@ asn1_der_decoding_element (asn1_node * structure, const char *elementName,
 		  if (state == OTHER_BRANCH)
 		    {
 		      len3 =
-			asn1_get_length_der (der + counter, len - counter,
+			asn1_internal_get_length_der (der + counter, len - counter,
 					     &len2);
 		      if (len3 < 0)
 			{
@@ -1942,7 +1942,7 @@ asn1_der_decoding_element (asn1_node * structure, const char *elementName,
 		  else
 		    {		/*  state==SAME_BRANCH or state==FOUND */
 		      len3 =
-			asn1_get_length_der (der + counter, len - counter,
+			asn1_internal_get_length_der (der + counter, len - counter,
 					     &len2);
 		      if (len3 < 0)
 			{
@@ -1967,7 +1967,7 @@ asn1_der_decoding_element (asn1_node * structure, const char *elementName,
 			      if (type_field (p2->type) != ASN1_ETYPE_TAG)
 				{
 				  p3 = p2->right;
-				  asn1_delete_structure (&p2);
+				  asn1_internal_delete_structure (&p2);
 				  p2 = p3;
 				}
 			      else
@@ -2012,7 +2012,7 @@ asn1_der_decoding_element (asn1_node * structure, const char *elementName,
 		  if (state == OTHER_BRANCH)
 		    {
 		      len3 =
-			asn1_get_length_der (der + counter, len - counter,
+			asn1_internal_get_length_der (der + counter, len - counter,
 					     &len2);
 		      if (len3 < 0)
 			{
@@ -2025,7 +2025,7 @@ asn1_der_decoding_element (asn1_node * structure, const char *elementName,
 		  else
 		    {		/* state==FOUND or state==SAME_BRANCH */
 		      len3 =
-			asn1_get_length_der (der + counter, len - counter,
+			asn1_internal_get_length_der (der + counter, len - counter,
 					     &len2);
 		      if (len3 < 0)
 			{
@@ -2055,7 +2055,7 @@ asn1_der_decoding_element (asn1_node * structure, const char *elementName,
 
 	      break;
 	    case ASN1_ETYPE_ANY:
-	      if (asn1_get_tag_der
+	      if (asn1_internal_get_tag_der
 		  (der + counter, len - counter, &class, &len2,
 		   &tag) != ASN1_SUCCESS)
 		{
@@ -2070,7 +2070,7 @@ asn1_der_decoding_element (asn1_node * structure, const char *elementName,
 		}
 
 	      len4 =
-		asn1_get_length_der (der + counter + len2,
+		asn1_internal_get_length_der (der + counter + len2,
 				     len - counter - len2, &len3);
 	      if (len4 < -1)
 		{
@@ -2262,7 +2262,7 @@ asn1_der_decoding_element (asn1_node * structure, const char *elementName,
   return ASN1_SUCCESS;
 
 cleanup:
-  asn1_delete_structure (structure);
+  asn1_internal_delete_structure (structure);
   return result;
 }
 
@@ -2292,7 +2292,7 @@ cleanup:
  *   doesn't match the structure ELEMENT.
  **/
 int
-asn1_der_decoding_startEnd (asn1_node element, const void *ider, int ider_len,
+asn1_internal_der_decoding_startEnd (asn1_node element, const void *ider, int ider_len,
 			    const char *name_element, int *start, int *end)
 {
   asn1_node node, node_to_find, p, p2;
@@ -2307,7 +2307,7 @@ asn1_der_decoding_startEnd (asn1_node element, const void *ider, int ider_len,
   if (node == NULL)
     return ASN1_ELEMENT_NOT_FOUND;
 
-  node_to_find = asn1_find_node (node, name_element);
+  node_to_find = asn1_internal_find_node (node, name_element);
 
   if (node_to_find == NULL)
     return ASN1_ELEMENT_NOT_FOUND;
@@ -2492,7 +2492,7 @@ asn1_der_decoding_startEnd (asn1_node element, const void *ider, int ider_len,
 	    case ASN1_ETYPE_VISIBLE_STRING:
 	    case ASN1_ETYPE_BIT_STRING:
 	      len2 =
-		asn1_get_length_der (der + counter, ider_len, &len3);
+		asn1_internal_get_length_der (der + counter, ider_len, &len3);
 	      if (len2 < 0)
 	        {
 		  warn();
@@ -2508,7 +2508,7 @@ asn1_der_decoding_startEnd (asn1_node element, const void *ider, int ider_len,
 	      if (move != UP)
 		{
 		  len3 =
-		    asn1_get_length_der (der + counter, ider_len, &len2);
+		    asn1_internal_get_length_der (der + counter, ider_len, &len2);
 		  if (len3 < -1)
 		    {
   		      warn();
@@ -2538,7 +2538,7 @@ asn1_der_decoding_startEnd (asn1_node element, const void *ider, int ider_len,
 	      if (move != UP)
 		{
 		  len3 =
-		    asn1_get_length_der (der + counter, ider_len, &len2);
+		    asn1_internal_get_length_der (der + counter, ider_len, &len2);
 		  if (len3 < -1)
 		    {
   		      warn();
@@ -2577,7 +2577,7 @@ asn1_der_decoding_startEnd (asn1_node element, const void *ider, int ider_len,
 	      move = RIGHT;
 	      break;
 	    case ASN1_ETYPE_ANY:
-	      if (asn1_get_tag_der
+	      if (asn1_internal_get_tag_der
 		  (der + counter, ider_len, &class, &len2,
 		   &tag) != ASN1_SUCCESS)
 		 {
@@ -2588,7 +2588,7 @@ asn1_der_decoding_startEnd (asn1_node element, const void *ider, int ider_len,
 	      DECR_LEN(ider_len, len2);
 
 	      len4 =
-		asn1_get_length_der (der + counter + len2,
+		asn1_internal_get_length_der (der + counter + len2,
 				     ider_len, &len3);
 	      if (len4 < -1)
 	        {
@@ -2702,7 +2702,7 @@ cleanup:
  *   depending on DER decoding.
  **/
 int
-asn1_expand_any_defined_by (asn1_node definitions, asn1_node * element)
+asn1_internal_expand_any_defined_by (asn1_node definitions, asn1_node * element)
 {
   char name[2 * ASN1_MAX_NAME_SIZE + 1],
     value[ASN1_MAX_NAME_SIZE];
@@ -2794,7 +2794,7 @@ asn1_expand_any_defined_by (asn1_node definitions, asn1_node * element)
 
 		      len = ASN1_MAX_NAME_SIZE;
 		      result =
-			asn1_read_value (definitions, name, value, &len);
+			asn1_internal_read_value (definitions, name, value, &len);
 
 		      if ((result == ASN1_SUCCESS)
 			  && (!_asn1_strcmp (p3->value, value)))
@@ -2809,18 +2809,18 @@ asn1_expand_any_defined_by (asn1_node definitions, asn1_node * element)
 			      snprintf(name, sizeof(name), "%s.%s", definitionsName, p2->name);
 
 			      result =
-				asn1_create_element (definitions, name, &aux);
+				asn1_internal_create_element (definitions, name, &aux);
 			      if (result == ASN1_SUCCESS)
 				{
 				  _asn1_cpy_name (aux, p);
 				  len2 =
-				    asn1_get_length_der (p->value,
+				    asn1_internal_get_length_der (p->value,
 							 p->value_len, &len3);
 				  if (len2 < 0)
 				    return ASN1_DER_ERROR;
 
 				  result =
-				    asn1_der_decoding (&aux, p->value + len3,
+				    asn1_internal_der_decoding (&aux, p->value + len3,
 						       len2,
 						       errorDescription);
 				  if (result == ASN1_SUCCESS)
@@ -2829,7 +2829,7 @@ asn1_expand_any_defined_by (asn1_node definitions, asn1_node * element)
 				      _asn1_set_right (aux, p->right);
 				      _asn1_set_right (p, aux);
 
-				      result = asn1_delete_structure (&p);
+				      result = asn1_internal_delete_structure (&p);
 				      if (result == ASN1_SUCCESS)
 					{
 					  p = aux;
@@ -2837,20 +2837,20 @@ asn1_expand_any_defined_by (asn1_node definitions, asn1_node * element)
 					  break;
 					}
 				      else
-					{	/* error with asn1_delete_structure */
-					  asn1_delete_structure (&aux);
+					{	/* error with asn1_internal_delete_structure */
+					  asn1_internal_delete_structure (&aux);
 					  retCode = result;
 					  break;
 					}
 				    }
 				  else
-				    {	/* error with asn1_der_decoding */
+				    {	/* error with asn1_internal_der_decoding */
 				      retCode = result;
 				      break;
 				    }
 				}
 			      else
-				{	/* error with asn1_create_element */
+				{	/* error with asn1_internal_create_element */
 				  retCode = result;
 				  break;
 				}
@@ -2930,8 +2930,8 @@ asn1_expand_any_defined_by (asn1_node definitions, asn1_node * element)
  *   use for expansion, or other errors depending on DER decoding.
  **/
 int
-asn1_expand_octet_string (asn1_node definitions, asn1_node * element,
-			  const char *octetName, const char *objectName)
+asn1_internal_expand_octet_string (asn1_node definitions, asn1_node * element,
+				   const char *octetName, const char *objectName)
 {
   char name[2 * ASN1_MAX_NAME_SIZE + 1], value[ASN1_MAX_NAME_SIZE];
   int retCode = ASN1_SUCCESS, result;
@@ -2943,7 +2943,7 @@ asn1_expand_octet_string (asn1_node definitions, asn1_node * element,
   if ((definitions == NULL) || (*element == NULL))
     return ASN1_ELEMENT_NOT_FOUND;
 
-  octetNode = asn1_find_node (*element, octetName);
+  octetNode = asn1_internal_find_node (*element, octetName);
   if (octetNode == NULL)
     return ASN1_ELEMENT_NOT_FOUND;
   if (type_field (octetNode->type) != ASN1_ETYPE_OCTET_STRING)
@@ -2951,7 +2951,7 @@ asn1_expand_octet_string (asn1_node definitions, asn1_node * element,
   if (octetNode->value == NULL)
     return ASN1_VALUE_NOT_FOUND;
 
-  objectNode = asn1_find_node (*element, objectName);
+  objectNode = asn1_internal_find_node (*element, objectName);
   if (objectNode == NULL)
     return ASN1_ELEMENT_NOT_FOUND;
 
@@ -2974,7 +2974,7 @@ asn1_expand_octet_string (asn1_node definitions, asn1_node * element,
 	  strcat (name, p2->name);
 
 	  len = sizeof (value);
-	  result = asn1_read_value (definitions, name, value, &len);
+	  result = asn1_internal_read_value (definitions, name, value, &len);
 
 	  if ((result == ASN1_SUCCESS)
 	      && (!_asn1_strcmp (objectNode->value, value)))
@@ -2991,18 +2991,18 @@ asn1_expand_octet_string (asn1_node definitions, asn1_node * element,
 		  strcat (name, ".");
 		  strcat (name, p2->name);
 
-		  result = asn1_create_element (definitions, name, &aux);
+		  result = asn1_internal_create_element (definitions, name, &aux);
 		  if (result == ASN1_SUCCESS)
 		    {
 		      _asn1_cpy_name (aux, octetNode);
 		      len2 =
-			asn1_get_length_der (octetNode->value,
+			asn1_internal_get_length_der (octetNode->value,
 					     octetNode->value_len, &len3);
 		      if (len2 < 0)
 			return ASN1_DER_ERROR;
 
 		      result =
-			asn1_der_decoding (&aux, octetNode->value + len3,
+			asn1_internal_der_decoding (&aux, octetNode->value + len3,
 					   len2, errorDescription);
 		      if (result == ASN1_SUCCESS)
 			{
@@ -3010,27 +3010,27 @@ asn1_expand_octet_string (asn1_node definitions, asn1_node * element,
 			  _asn1_set_right (aux, octetNode->right);
 			  _asn1_set_right (octetNode, aux);
 
-			  result = asn1_delete_structure (&octetNode);
+			  result = asn1_internal_delete_structure (&octetNode);
 			  if (result == ASN1_SUCCESS)
 			    {
 			      aux = NULL;
 			      break;
 			    }
 			  else
-			    {	/* error with asn1_delete_structure */
-			      asn1_delete_structure (&aux);
+			    {	/* error with asn1_internal_delete_structure */
+			      asn1_internal_delete_structure (&aux);
 			      retCode = result;
 			      break;
 			    }
 			}
 		      else
-			{	/* error with asn1_der_decoding */
+			{	/* error with asn1_internal_der_decoding */
 			  retCode = result;
 			  break;
 			}
 		    }
 		  else
-		    {		/* error with asn1_create_element */
+		    {		/* error with asn1_internal_create_element */
 		      retCode = result;
 		      break;
 		    }
@@ -3067,9 +3067,9 @@ asn1_expand_octet_string (asn1_node definitions, asn1_node * element,
  * Returns: %ASN1_SUCCESS if successful or an error value.
  **/
 int
-asn1_decode_simple_der (unsigned int etype, const unsigned char *der,
-			unsigned int der_len, const unsigned char **str,
-			unsigned int *str_len)
+asn1_internal_decode_simple_der (unsigned int etype, const unsigned char *der,
+				 unsigned int der_len, const unsigned char **str,
+				 unsigned int *str_len)
 {
   int tag_len, len_len;
   const unsigned char *p;
@@ -3088,7 +3088,7 @@ asn1_decode_simple_der (unsigned int etype, const unsigned char *der,
     return ASN1_VALUE_NOT_VALID;
 
   p = der;
-  ret = asn1_get_tag_der (p, der_len, &class, &tag_len, &tag);
+  ret = asn1_internal_get_tag_der (p, der_len, &class, &tag_len, &tag);
   if (ret != ASN1_SUCCESS)
     return ret;
 
@@ -3098,7 +3098,7 @@ asn1_decode_simple_der (unsigned int etype, const unsigned char *der,
   p += tag_len;
   der_len -= tag_len;
 
-  ret = asn1_get_length_der (p, der_len, &len_len);
+  ret = asn1_internal_get_length_der (p, der_len, &len_len);
   if (ret < 0)
     return ASN1_DER_ERROR;
 
diff --git a/lib/element.c b/lib/element.c
index ac30e46..5afc67c 100644
--- a/lib/element.c
+++ b/lib/element.c
@@ -271,8 +271,8 @@ _asn1_append_sequence_set (asn1_node node)
  *   %ASN1_VALUE_NOT_VALID if @ivalue has a wrong format.
  **/
 int
-asn1_write_value (asn1_node node_root, const char *name,
-		  const void *ivalue, int len)
+asn1_internal_write_value (asn1_node node_root, const char *name,
+			   const void *ivalue, int len)
 {
   asn1_node node, p, p2;
   unsigned char *temp, *value_temp = NULL, *default_temp = NULL;
@@ -281,13 +281,13 @@ asn1_write_value (asn1_node node_root, const char *name,
   const unsigned char *value = ivalue;
   unsigned int type;
 
-  node = asn1_find_node (node_root, name);
+  node = asn1_internal_find_node (node_root, name);
   if (node == NULL)
     return ASN1_ELEMENT_NOT_FOUND;
 
   if ((node->type & CONST_OPTION) && (value == NULL) && (len == 0))
     {
-      asn1_delete_structure (&node);
+      asn1_internal_delete_structure (&node);
       return ASN1_SUCCESS;
     }
 
@@ -301,7 +301,7 @@ asn1_write_value (asn1_node node_root, const char *name,
 	p = p->right;
 
       while (p->right)
-	asn1_delete_structure (&p->right);
+	asn1_internal_delete_structure (&p->right);
 
       return ASN1_SUCCESS;
     }
@@ -568,12 +568,12 @@ asn1_write_value (asn1_node node_root, const char *name,
     case ASN1_ETYPE_BIT_STRING:
       if (len == 0)
 	len = _asn1_strlen (value);
-      asn1_length_der ((len >> 3) + 2, NULL, &len2);
+      asn1_internal_length_der ((len >> 3) + 2, NULL, &len2);
       temp = malloc ((len >> 3) + 2 + len2);
       if (temp == NULL)
 	return ASN1_MEM_ALLOC_ERROR;
 
-      asn1_bit_der (value, len, temp, &len2);
+      asn1_internal_bit_der (value, len, temp, &len2);
       _asn1_set_value_m (node, temp, len2);
       temp = NULL;
       break;
@@ -588,7 +588,7 @@ asn1_write_value (asn1_node node_root, const char *name,
 		{
 		  if (p2 != p)
 		    {
-		      asn1_delete_structure (&p2);
+		      asn1_internal_delete_structure (&p2);
 		      p2 = node->down;
 		    }
 		  else
@@ -726,9 +726,9 @@ asn1_write_value (asn1_node node_root, const char *name,
  *   bytes needed.
  **/
 int
-asn1_read_value (asn1_node root, const char *name, void *ivalue, int *len)
+asn1_internal_read_value (asn1_node root, const char *name, void *ivalue, int *len)
 {
-  return asn1_read_value_type (root, name, ivalue, len, NULL);
+  return asn1_internal_read_value_type (root, name, ivalue, len, NULL);
 }
 
 /**
@@ -797,8 +797,8 @@ asn1_read_value (asn1_node root, const char *name, void *ivalue, int *len)
  *   bytes needed.
  **/
 int
-asn1_read_value_type (asn1_node root, const char *name, void *ivalue,
-		      int *len, unsigned int *etype)
+asn1_internal_read_value_type (asn1_node root, const char *name, void *ivalue,
+			       int *len, unsigned int *etype)
 {
   asn1_node node, p, p2;
   int len2, len3, result;
@@ -806,7 +806,7 @@ asn1_read_value_type (asn1_node root, const char *name, void *ivalue,
   unsigned char *value = ivalue;
   unsigned type;
 
-  node = asn1_find_node (root, name);
+  node = asn1_internal_find_node (root, name);
   if (node == NULL)
     return ASN1_ELEMENT_NOT_FOUND;
 
@@ -888,7 +888,7 @@ asn1_read_value_type (asn1_node root, const char *name, void *ivalue,
       else
 	{
 	  len2 = -1;
-	  result = asn1_get_octet_der
+	  result = asn1_internal_get_octet_der
 	      (node->value, node->value_len, &len2, value, value_size,
 	       len);
           if (result != ASN1_SUCCESS)
@@ -943,7 +943,7 @@ asn1_read_value_type (asn1_node root, const char *name, void *ivalue,
     case ASN1_ETYPE_UTF8_STRING:
     case ASN1_ETYPE_VISIBLE_STRING:
       len2 = -1;
-      result = asn1_get_octet_der
+      result = asn1_internal_get_octet_der
 	  (node->value, node->value_len, &len2, value, value_size,
 	   len);
       if (result != ASN1_SUCCESS)
@@ -951,7 +951,7 @@ asn1_read_value_type (asn1_node root, const char *name, void *ivalue,
       break;
     case ASN1_ETYPE_BIT_STRING:
       len2 = -1;
-      result = asn1_get_bit_der
+      result = asn1_internal_get_bit_der
 	  (node->value, node->value_len, &len2, value, value_size,
 	   len);
       if (result != ASN1_SUCCESS)
@@ -962,7 +962,7 @@ asn1_read_value_type (asn1_node root, const char *name, void *ivalue,
       break;
     case ASN1_ETYPE_ANY:
       len3 = -1;
-      len2 = asn1_get_length_der (node->value, node->value_len, &len3);
+      len2 = asn1_internal_get_length_der (node->value, node->value_len, &len3);
       if (len2 < 0)
 	return ASN1_DER_ERROR;
       PUT_VALUE (value, value_size, node->value + len3, len2);
@@ -991,12 +991,12 @@ asn1_read_value_type (asn1_node root, const char *name, void *ivalue,
  *   @name is not a valid element.
  **/
 int
-asn1_read_tag (asn1_node root, const char *name, int *tagValue,
-	       int *classValue)
+asn1_internal_read_tag (asn1_node root, const char *name, int *tagValue,
+			int *classValue)
 {
   asn1_node node, p, pTag;
 
-  node = asn1_find_node (root, name);
+  node = asn1_internal_find_node (root, name);
   if (node == NULL)
     return ASN1_ELEMENT_NOT_FOUND;
 
@@ -1066,7 +1066,7 @@ asn1_read_tag (asn1_node root, const char *name, int *tagValue,
  * Returns: %ASN1_SUCCESS if the node exists.
  **/
 int
-asn1_read_node_value (asn1_node node, asn1_data_node_st * data)
+asn1_internal_read_node_value (asn1_node node, asn1_data_node_st * data)
 {
   data->name = node->name;
   data->value = node->value;
diff --git a/lib/errors.c b/lib/errors.c
index e9fa302..6a35d2b 100644
--- a/lib/errors.c
+++ b/lib/errors.c
@@ -66,9 +66,9 @@ static const libtasn1_error_entry error_algorithms[] = {
  * Since: 1.6
  **/
 void
-asn1_perror (int error)
+asn1_internal_perror (int error)
 {
-  const char *str = asn1_strerror (error);
+  const char *str = asn1_internal_strerror (error);
   fprintf (stderr, "LIBTASN1 ERROR: %s\n", str ? str : "(null)");
 }
 
@@ -86,7 +86,7 @@ asn1_perror (int error)
  * Since: 1.6
  **/
 const char *
-asn1_strerror (int error)
+asn1_internal_strerror (int error)
 {
   const libtasn1_error_entry *p;
 
diff --git a/lib/int.h b/lib/int.h
index 3701e5f..f235238 100644
--- a/lib/int.h
+++ b/lib/int.h
@@ -36,7 +36,7 @@
 #include <sys/types.h>
 #endif
 
-#include <libtasn1.h>
+#include <libtasn1-internal.h>
 
 #define ASN1_SMALL_VALUE_SIZE 16
 
diff --git a/lib/libtasn1-internal.h b/lib/libtasn1-internal.h
new file mode 100644
index 0000000..4cecb78
--- /dev/null
+++ b/lib/libtasn1-internal.h
@@ -0,0 +1,380 @@
+/*
+ * Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ *
+ * This file is part of LIBTASN1.
+ *
+ * LIBTASN1 is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * LIBTASN1 is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with LIBTASN1; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA
+ *
+ */
+
+#ifndef LIBTASN1_INTERNAL_H
+#define LIBTASN1_INTERNAL_H
+
+#ifndef ASN1_API
+#if defined ASN1_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY
+#define ASN1_API __attribute__((__visibility__("default")))
+#elif defined ASN1_BUILDING && defined _MSC_VER && ! defined ASN1_STATIC
+#define ASN1_API __declspec(dllexport)
+#elif defined _MSC_VER && ! defined ASN1_STATIC
+#define ASN1_API __declspec(dllimport)
+#else
+#define ASN1_API
+#endif
+#endif
+
+#include <sys/types.h>
+#include <time.h>
+#include <stdio.h>		/* for FILE* */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#define ASN1_VERSION "3.6"
+
+#if defined(__GNUC__) && !defined(ASN1_INTERNAL_BUILD)
+# define _ASN1_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+# if _ASN1_GCC_VERSION >= 30100
+#  ifndef LIBTASN1_COMPAT_WRAPPER
+#    define _ASN1_GCC_ATTR_DEPRECATED __attribute__ ((__deprecated__))
+#  else
+#    define _ASN1_GCC_ATTR_DEPRECATED
+#  endif
+# endif
+#endif
+
+#ifndef _ASN1_GCC_ATTR_DEPRECATED
+#define _ASN1_GCC_ATTR_DEPRECATED
+#endif
+
+  /*****************************************/
+  /* Errors returned by libtasn1 functions */
+  /*****************************************/
+#define ASN1_SUCCESS			0
+#define ASN1_FILE_NOT_FOUND		1
+#define ASN1_ELEMENT_NOT_FOUND		2
+#define ASN1_IDENTIFIER_NOT_FOUND	3
+#define ASN1_DER_ERROR			4
+#define ASN1_VALUE_NOT_FOUND		5
+#define ASN1_GENERIC_ERROR		6
+#define ASN1_VALUE_NOT_VALID		7
+#define ASN1_TAG_ERROR			8
+#define ASN1_TAG_IMPLICIT		9
+#define ASN1_ERROR_TYPE_ANY		10
+#define ASN1_SYNTAX_ERROR		11
+#define ASN1_MEM_ERROR			12
+#define ASN1_MEM_ALLOC_ERROR		13
+#define ASN1_DER_OVERFLOW		14
+#define ASN1_NAME_TOO_LONG		15
+#define ASN1_ARRAY_ERROR		16
+#define ASN1_ELEMENT_NOT_EMPTY		17
+
+  /*************************************/
+  /* Constants used in asn1_visit_tree */
+  /*************************************/
+#define ASN1_PRINT_NAME			1
+#define ASN1_PRINT_NAME_TYPE		2
+#define ASN1_PRINT_NAME_TYPE_VALUE	3
+#define ASN1_PRINT_ALL			4
+
+  /*****************************************/
+  /* Constants returned by asn1_read_tag   */
+  /*****************************************/
+#define ASN1_CLASS_UNIVERSAL		0x00	/* old: 1 */
+#define ASN1_CLASS_APPLICATION		0x40	/* old: 2 */
+#define ASN1_CLASS_CONTEXT_SPECIFIC	0x80	/* old: 3 */
+#define ASN1_CLASS_PRIVATE		0xC0	/* old: 4 */
+#define ASN1_CLASS_STRUCTURED		0x20
+
+  /*****************************************/
+  /* Constants returned by asn1_read_tag   */
+  /*****************************************/
+#define ASN1_TAG_BOOLEAN		0x01
+#define ASN1_TAG_INTEGER		0x02
+#define ASN1_TAG_SEQUENCE		0x10
+#define ASN1_TAG_SET			0x11
+#define ASN1_TAG_OCTET_STRING		0x04
+#define ASN1_TAG_BIT_STRING		0x03
+#define ASN1_TAG_UTCTime		0x17
+#define ASN1_TAG_GENERALIZEDTime	0x18
+#define ASN1_TAG_OBJECT_ID		0x06
+#define ASN1_TAG_ENUMERATED		0x0A
+#define ASN1_TAG_NULL			0x05
+#define ASN1_TAG_GENERALSTRING		0x1B
+#define ASN1_TAG_NUMERIC_STRING		0x12
+#define ASN1_TAG_IA5_STRING		0x16
+#define ASN1_TAG_TELETEX_STRING		0x14
+#define ASN1_TAG_PRINTABLE_STRING	0x13
+#define ASN1_TAG_UNIVERSAL_STRING	0x1C
+#define ASN1_TAG_BMP_STRING		0x1E
+#define ASN1_TAG_UTF8_STRING		0x0C
+#define ASN1_TAG_VISIBLE_STRING		0x1A
+
+  /******************************************************/
+  /* Structure definition used for the node of the tree */
+  /* that represent an ASN.1 DEFINITION.                */
+  /******************************************************/
+
+  typedef struct asn1_node_st asn1_node_st;
+
+  typedef asn1_node_st *asn1_node;
+
+  /* maximum number of characters of a name */
+  /* inside a file with ASN1 definitons     */
+#define ASN1_MAX_NAME_SIZE 64
+
+
+  /*****************************************/
+  /* For the on-disk format of ASN.1 trees */
+  /*****************************************/
+  struct asn1_static_node_st
+  {
+    const char *name;		/* Node name */
+    unsigned int type;		/* Node type */
+    const void *value;		/* Node value */
+  };
+  typedef struct asn1_static_node_st asn1_static_node;
+
+/* List of constants for field type of node_asn  */
+#define ASN1_ETYPE_INVALID        0
+#define ASN1_ETYPE_CONSTANT       1
+#define ASN1_ETYPE_IDENTIFIER     2
+#define ASN1_ETYPE_INTEGER        3
+#define ASN1_ETYPE_BOOLEAN        4
+#define ASN1_ETYPE_SEQUENCE       5
+#define ASN1_ETYPE_BIT_STRING     6
+#define ASN1_ETYPE_OCTET_STRING   7
+#define ASN1_ETYPE_TAG            8
+#define ASN1_ETYPE_DEFAULT        9
+#define ASN1_ETYPE_SIZE          10
+#define ASN1_ETYPE_SEQUENCE_OF   11
+#define ASN1_ETYPE_OBJECT_ID     12
+#define ASN1_ETYPE_ANY           13
+#define ASN1_ETYPE_SET           14
+#define ASN1_ETYPE_SET_OF        15
+#define ASN1_ETYPE_DEFINITIONS   16
+#define ASN1_ETYPE_CHOICE        18
+#define ASN1_ETYPE_IMPORTS       19
+#define ASN1_ETYPE_NULL          20
+#define ASN1_ETYPE_ENUMERATED    21
+#define ASN1_ETYPE_GENERALSTRING 27
+#define ASN1_ETYPE_NUMERIC_STRING 28
+#define ASN1_ETYPE_IA5_STRING     29
+#define ASN1_ETYPE_TELETEX_STRING 30
+#define ASN1_ETYPE_PRINTABLE_STRING 31
+#define ASN1_ETYPE_UNIVERSAL_STRING 32
+#define ASN1_ETYPE_BMP_STRING     33
+#define ASN1_ETYPE_UTF8_STRING    34
+#define ASN1_ETYPE_VISIBLE_STRING 35
+#define ASN1_ETYPE_UTC_TIME       36
+#define ASN1_ETYPE_GENERALIZED_TIME 37
+
+/* Flags used by asn1_delete_structure2() */
+
+/* makes sure the values are zeroized prior to deinitialization */
+#define ASN1_DELETE_FLAG_ZEROIZE 1
+
+
+  struct asn1_data_node_st
+  {
+    const char *name;		/* Node name */
+    const void *value;		/* Node value */
+    unsigned int value_len;	/* Node value size */
+    unsigned int type;		/* Node value type (ASN1_ETYPE_*) */
+  };
+  typedef struct asn1_data_node_st asn1_data_node_st;
+
+  /***********************************/
+  /*  Fixed constants                */
+  /***********************************/
+
+
+  /* maximum number of characters */
+  /* of a description message     */
+  /* (null character included)    */
+#define ASN1_MAX_ERROR_DESCRIPTION_SIZE 128
+
+  /***********************************/
+  /*  Functions definitions          */
+  /***********************************/
+
+  extern ASN1_API int
+    asn1_internal_parser2tree (const char *file,
+			       asn1_node * definitions, char *error_desc);
+
+  extern ASN1_API int
+    asn1_internal_parser2array (const char *inputFileName,
+				const char *outputFileName,
+				const char *vectorName, char *error_desc);
+
+  extern ASN1_API int
+    asn1_internal_array2tree (const asn1_static_node * array,
+			      asn1_node * definitions, char *errorDescription);
+
+  extern ASN1_API void
+    asn1_internal_print_structure (FILE * out, asn1_node structure,
+				   const char *name, int mode);
+
+  extern ASN1_API int
+    asn1_internal_create_element (asn1_node definitions,
+				  const char *source_name, asn1_node * element);
+
+  extern ASN1_API int asn1_internal_delete_structure (asn1_node * structure);
+
+  extern ASN1_API int asn1_internal_delete_structure2 (asn1_node * structure, unsigned int flags);
+
+  extern ASN1_API int
+    asn1_internal_delete_element (asn1_node structure, const char *element_name);
+
+  extern ASN1_API int
+    asn1_internal_write_value (asn1_node node_root, const char *name,
+			       const void *ivalue, int len);
+
+  extern ASN1_API int
+    asn1_internal_read_value (asn1_node root, const char *name,
+			      void *ivalue, int *len);
+
+  extern ASN1_API int
+    asn1_internal_read_value_type (asn1_node root, const char *name,
+				   void *ivalue, int *len, unsigned int *etype);
+
+  extern ASN1_API int
+    asn1_internal_read_node_value (asn1_node node, asn1_data_node_st * data);
+
+  extern ASN1_API int
+    asn1_internal_number_of_elements (asn1_node element, const char *name, int *num);
+
+  extern ASN1_API int
+    asn1_internal_der_coding (asn1_node element, const char *name,
+			      void *ider, int *len, char *ErrorDescription);
+
+  extern ASN1_API int
+    asn1_internal_der_decoding (asn1_node * element, const void *ider,
+				int len, char *errorDescription);
+
+  /* Do not use. Use asn1_der_decoding() instead. */
+  extern ASN1_API int
+    asn1_internal_der_decoding_element (asn1_node * structure,
+					const char *elementName,
+					const void *ider, int len,
+					char *errorDescription) _ASN1_GCC_ATTR_DEPRECATED;
+
+  extern ASN1_API int
+    asn1_internal_der_decoding_startEnd (asn1_node element,
+					 const void *ider, int len,
+					 const char *name_element,
+					 int *start, int *end);
+
+  extern ASN1_API int
+    asn1_internal_expand_any_defined_by (asn1_node definitions, asn1_node * element);
+
+  extern ASN1_API int
+    asn1_internal_expand_octet_string (asn1_node definitions,
+				       asn1_node * element,
+				       const char *octetName, const char *objectName);
+
+  extern ASN1_API int
+    asn1_internal_read_tag (asn1_node root, const char *name,
+			    int *tagValue, int *classValue);
+
+  extern ASN1_API const char *asn1_internal_find_structure_from_oid (asn1_node
+								     definitions,
+								     const char
+								     *oidValue);
+
+  extern ASN1_API const char *asn1_internal_check_version (const char *req_version);
+
+  extern ASN1_API const char *asn1_internal_strerror (int error);
+
+  extern ASN1_API void asn1_internal_perror (int error);
+
+#define ASN1_MAX_TAG_SIZE 4
+#define ASN1_MAX_LENGTH_SIZE 9
+#define ASN1_MAX_TL_SIZE (ASN1_MAX_TAG_SIZE+ASN1_MAX_LENGTH_SIZE)
+  extern ASN1_API long
+    asn1_internal_get_length_der (const unsigned char *der, int der_len, int *len);
+
+  extern ASN1_API long
+    asn1_internal_get_length_ber (const unsigned char *ber, int ber_len, int *len);
+
+  extern ASN1_API void
+    asn1_internal_length_der (unsigned long int len, unsigned char *der, int *der_len);
+
+  /* Other utility functions. */
+
+  extern ASN1_API
+    int asn1_internal_decode_simple_der (unsigned int etype, const unsigned char *der,
+					 unsigned int der_len,
+					 const unsigned char **str,
+					 unsigned int *str_len);
+
+  extern ASN1_API int
+    asn1_internal_encode_simple_der (unsigned int etype, const unsigned char *str,
+				     unsigned int str_len, unsigned char *tl,
+				     unsigned int *tl_len);
+
+  extern ASN1_API asn1_node
+    asn1_internal_find_node (asn1_node pointer, const char *name);
+
+  extern ASN1_API int
+    asn1_internal_copy_node (asn1_node dst, const char *dst_name,
+			     asn1_node src, const char *src_name);
+
+  /* Internal and low-level DER utility functions. */
+
+  extern ASN1_API int
+    asn1_internal_get_tag_der (const unsigned char *der, int der_len,
+			       unsigned char *cls, int *len, unsigned long *tag);
+
+  extern ASN1_API void
+    asn1_internal_octet_der (const unsigned char *str, int str_len,
+			     unsigned char *der, int *der_len);
+
+  extern ASN1_API int
+    asn1_internal_get_octet_der (const unsigned char *der, int der_len,
+				 int *ret_len, unsigned char *str,
+				 int str_size, int *str_len);
+
+  extern ASN1_API void asn1_internal_bit_der (const unsigned char *str, int bit_len,
+					      unsigned char *der, int *der_len);
+
+  extern ASN1_API int
+    asn1_internal_get_bit_der (const unsigned char *der, int der_len,
+			       int *ret_len, unsigned char *str,
+			       int str_size, int *bit_len);
+
+/* Compatibility types */
+
+  typedef int asn1_retCode;	/* type returned by libtasn1 functions */
+
+#define node_asn_struct asn1_node_st
+#define node_asn asn1_node_st
+#define ASN1_TYPE asn1_node
+#define ASN1_TYPE_EMPTY NULL
+
+#define static_struct_asn asn1_static_node_st
+#define ASN1_ARRAY_TYPE asn1_static_node
+#define asn1_static_node_t asn1_static_node
+
+#define node_data_struct asn1_data_node_st
+#define ASN1_DATA_NODE asn1_data_node_st
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif				/* LIBTASN1_INTERNAL_H */
diff --git a/lib/libtasn1.h b/lib/libtasn1.h
index a457068..6d40174 100644
--- a/lib/libtasn1.h
+++ b/lib/libtasn1.h
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2002-2014 Free Software Foundation, Inc.
+ *      Copyright (C) 2004, 2005, 2006, 2008 Free Software Foundation
+ *      Copyright (C) 2002 Fabio Fiorina
  *
  * This file is part of LIBTASN1.
  *
@@ -20,13 +21,29 @@
  *
  */
 
+/*******************************************************************************
+ * This file is the original public header from libtasn1-1.5, as shipped with
+ * SLE11-SP3.  We ship this header along with the newer version of libtasn1-3.6,
+ * and implement the old functions here as a series of wrappers around the newer
+ * libtasn1.  This is to preserve API and ABI compatibility, while using a newer
+ * implementation of the library, which has fewer bugs.
+ *******************************************************************************
+ */
+
 #ifndef LIBTASN1_H
-#define LIBTASN1_H
+# define LIBTASN1_H
+
+#include <stdio.h>		/* for FILE* */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
 
 #ifndef ASN1_API
-#if defined ASN1_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY
+#if defined LIBTASN1_ITNERNAL_H && defined ASN1_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY
 #define ASN1_API __attribute__((__visibility__("default")))
-#elif defined ASN1_BUILDING && defined _MSC_VER && ! defined ASN1_STATIC
+#elif defined LIBTASN1_ITNERNAL_H && defined ASN1_BUILDING && defined _MSC_VER && ! defined ASN1_STATIC
 #define ASN1_API __declspec(dllexport)
 #elif defined _MSC_VER && ! defined ASN1_STATIC
 #define ASN1_API __declspec(dllimport)
@@ -35,339 +52,223 @@
 #endif
 #endif
 
+#define LIBTASN1_VERSION "1.5"
+
 #include <sys/types.h>
 #include <time.h>
-#include <stdio.h>		/* for FILE* */
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
+#define MAX_NAME_SIZE 128	/* maximum number of characters of a name */
+  /* inside a file with ASN1 definitons     */
+#define MAX_ERROR_DESCRIPTION_SIZE 128	/* maximum number of characters */
+  /* of a description message     */
+  /* (null character included)    */
 
-#define ASN1_VERSION "3.6"
 
-#if defined(__GNUC__) && !defined(ASN1_INTERNAL_BUILD)
-# define _ASN1_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
-# if _ASN1_GCC_VERSION >= 30100
-#  define _ASN1_GCC_ATTR_DEPRECATED __attribute__ ((__deprecated__))
-# endif
-#endif
+/* We only define the numeric macros if this header file is being included
+ * outside of libtasn1 itself - we don't want duplicated macros (from
+ * libtasn1-internal.h) while building the library.
+ */
+#ifndef LIBTASN1_INTERNAL_H
 
-#ifndef _ASN1_GCC_ATTR_DEPRECATED
-#define _ASN1_GCC_ATTR_DEPRECATED
-#endif
+  typedef int asn1_retCode;	/* type returned by libtasn1 functions */
 
   /*****************************************/
-  /* Errors returned by libtasn1 functions */
+  /*  Errors returned by libtasn1 functions */
   /*****************************************/
-#define ASN1_SUCCESS			0
-#define ASN1_FILE_NOT_FOUND		1
-#define ASN1_ELEMENT_NOT_FOUND		2
-#define ASN1_IDENTIFIER_NOT_FOUND	3
-#define ASN1_DER_ERROR			4
-#define ASN1_VALUE_NOT_FOUND		5
-#define ASN1_GENERIC_ERROR		6
-#define ASN1_VALUE_NOT_VALID		7
-#define ASN1_TAG_ERROR			8
-#define ASN1_TAG_IMPLICIT		9
-#define ASN1_ERROR_TYPE_ANY		10
-#define ASN1_SYNTAX_ERROR		11
-#define ASN1_MEM_ERROR			12
-#define ASN1_MEM_ALLOC_ERROR		13
-#define ASN1_DER_OVERFLOW		14
-#define ASN1_NAME_TOO_LONG		15
-#define ASN1_ARRAY_ERROR		16
-#define ASN1_ELEMENT_NOT_EMPTY		17
-
-  /*************************************/
-  /* Constants used in asn1_visit_tree */
-  /*************************************/
-#define ASN1_PRINT_NAME			1
-#define ASN1_PRINT_NAME_TYPE		2
-#define ASN1_PRINT_NAME_TYPE_VALUE	3
-#define ASN1_PRINT_ALL			4
+#define ASN1_SUCCESS               0
+#define ASN1_FILE_NOT_FOUND        1
+#define ASN1_ELEMENT_NOT_FOUND     2
+#define ASN1_IDENTIFIER_NOT_FOUND  3
+#define ASN1_DER_ERROR             4
+#define ASN1_VALUE_NOT_FOUND       5
+#define ASN1_GENERIC_ERROR         6
+#define ASN1_VALUE_NOT_VALID       7
+#define ASN1_TAG_ERROR             8
+#define ASN1_TAG_IMPLICIT          9
+#define ASN1_ERROR_TYPE_ANY        10
+#define ASN1_SYNTAX_ERROR          11
+#define ASN1_MEM_ERROR		   12
+#define ASN1_MEM_ALLOC_ERROR	   13
+#define ASN1_DER_OVERFLOW          14
+#define ASN1_NAME_TOO_LONG         15
+#define ASN1_ARRAY_ERROR           16
+#define ASN1_ELEMENT_NOT_EMPTY     17
+
+/*************************************/
+/* Constants used in asn1_visit_tree */
+/*************************************/
+#define ASN1_PRINT_NAME             1
+#define ASN1_PRINT_NAME_TYPE        2
+#define ASN1_PRINT_NAME_TYPE_VALUE  3
+#define ASN1_PRINT_ALL              4
+
+/*****************************************/
+/* Constants returned by asn1_read_tag   */
+/*****************************************/
+#define ASN1_CLASS_UNIVERSAL        0x00	/* old: 1 */
+#define ASN1_CLASS_APPLICATION      0x40	/* old: 2 */
+#define ASN1_CLASS_CONTEXT_SPECIFIC 0x80	/* old: 3 */
+#define ASN1_CLASS_PRIVATE          0xC0	/* old: 4 */
+#define ASN1_CLASS_STRUCTURED       0x20
+
+/*****************************************/
+/* Constants returned by asn1_read_tag   */
+/*****************************************/
+#define ASN1_TAG_BOOLEAN          0x01
+#define ASN1_TAG_INTEGER          0x02
+#define ASN1_TAG_SEQUENCE         0x10
+#define ASN1_TAG_SET              0x11
+#define ASN1_TAG_OCTET_STRING     0x04
+#define ASN1_TAG_BIT_STRING       0x03
+#define ASN1_TAG_UTCTime          0x17
+#define ASN1_TAG_GENERALIZEDTime  0x18
+#define ASN1_TAG_OBJECT_ID        0x06
+#define ASN1_TAG_ENUMERATED       0x0A
+#define ASN1_TAG_NULL             0x05
+#define ASN1_TAG_GENERALSTRING    0x1B
 
-  /*****************************************/
-  /* Constants returned by asn1_read_tag   */
-  /*****************************************/
-#define ASN1_CLASS_UNIVERSAL		0x00	/* old: 1 */
-#define ASN1_CLASS_APPLICATION		0x40	/* old: 2 */
-#define ASN1_CLASS_CONTEXT_SPECIFIC	0x80	/* old: 3 */
-#define ASN1_CLASS_PRIVATE		0xC0	/* old: 4 */
-#define ASN1_CLASS_STRUCTURED		0x20
+#endif
 
-  /*****************************************/
-  /* Constants returned by asn1_read_tag   */
-  /*****************************************/
-#define ASN1_TAG_BOOLEAN		0x01
-#define ASN1_TAG_INTEGER		0x02
-#define ASN1_TAG_SEQUENCE		0x10
-#define ASN1_TAG_SET			0x11
-#define ASN1_TAG_OCTET_STRING		0x04
-#define ASN1_TAG_BIT_STRING		0x03
-#define ASN1_TAG_UTCTime		0x17
-#define ASN1_TAG_GENERALIZEDTime	0x18
-#define ASN1_TAG_OBJECT_ID		0x06
-#define ASN1_TAG_ENUMERATED		0x0A
-#define ASN1_TAG_NULL			0x05
-#define ASN1_TAG_GENERALSTRING		0x1B
-#define ASN1_TAG_NUMERIC_STRING		0x12
-#define ASN1_TAG_IA5_STRING		0x16
-#define ASN1_TAG_TELETEX_STRING		0x14
-#define ASN1_TAG_PRINTABLE_STRING	0x13
-#define ASN1_TAG_UNIVERSAL_STRING	0x1C
-#define ASN1_TAG_BMP_STRING		0x1E
-#define ASN1_TAG_UTF8_STRING		0x0C
-#define ASN1_TAG_VISIBLE_STRING		0x1A
-
-  /******************************************************/
-  /* Structure definition used for the node of the tree */
-  /* that represent an ASN.1 DEFINITION.                */
-  /******************************************************/
-
-  typedef struct asn1_node_st asn1_node_st;
-
-  typedef asn1_node_st *asn1_node;
-
-  /* maximum number of characters of a name */
-  /* inside a file with ASN1 definitons     */
-#define ASN1_MAX_NAME_SIZE 64
+/******************************************************/
+/* Structure definition used for the node of the tree */
+/* that represent an ASN.1 DEFINITION.                */
+/******************************************************/
 
+#ifndef LIBTASN1_COMPAT_WRAPPER
 
-  /*****************************************/
-  /* For the on-disk format of ASN.1 trees */
-  /*****************************************/
-  struct asn1_static_node_st
+  struct node_asn_struct
   {
-    const char *name;		/* Node name */
+    char *name;			/* Node name */
     unsigned int type;		/* Node type */
-    const void *value;		/* Node value */
+    unsigned char *value;	/* Node value */
+    int value_len;
+    struct node_asn_struct *down;	/* Pointer to the son node */
+    struct node_asn_struct *right;	/* Pointer to the brother node */
+    struct node_asn_struct *left;	/* Pointer to the next list element */
   };
-  typedef struct asn1_static_node_st asn1_static_node;
-
-/* List of constants for field type of node_asn  */
-#define ASN1_ETYPE_INVALID        0
-#define ASN1_ETYPE_CONSTANT       1
-#define ASN1_ETYPE_IDENTIFIER     2
-#define ASN1_ETYPE_INTEGER        3
-#define ASN1_ETYPE_BOOLEAN        4
-#define ASN1_ETYPE_SEQUENCE       5
-#define ASN1_ETYPE_BIT_STRING     6
-#define ASN1_ETYPE_OCTET_STRING   7
-#define ASN1_ETYPE_TAG            8
-#define ASN1_ETYPE_DEFAULT        9
-#define ASN1_ETYPE_SIZE          10
-#define ASN1_ETYPE_SEQUENCE_OF   11
-#define ASN1_ETYPE_OBJECT_ID     12
-#define ASN1_ETYPE_ANY           13
-#define ASN1_ETYPE_SET           14
-#define ASN1_ETYPE_SET_OF        15
-#define ASN1_ETYPE_DEFINITIONS   16
-#define ASN1_ETYPE_CHOICE        18
-#define ASN1_ETYPE_IMPORTS       19
-#define ASN1_ETYPE_NULL          20
-#define ASN1_ETYPE_ENUMERATED    21
-#define ASN1_ETYPE_GENERALSTRING 27
-#define ASN1_ETYPE_NUMERIC_STRING 28
-#define ASN1_ETYPE_IA5_STRING     29
-#define ASN1_ETYPE_TELETEX_STRING 30
-#define ASN1_ETYPE_PRINTABLE_STRING 31
-#define ASN1_ETYPE_UNIVERSAL_STRING 32
-#define ASN1_ETYPE_BMP_STRING     33
-#define ASN1_ETYPE_UTF8_STRING    34
-#define ASN1_ETYPE_VISIBLE_STRING 35
-#define ASN1_ETYPE_UTC_TIME       36
-#define ASN1_ETYPE_GENERALIZED_TIME 37
-
-/* Flags used by asn1_delete_structure2() */
-
-/* makes sure the values are zeroized prior to deinitialization */
-#define ASN1_DELETE_FLAG_ZEROIZE 1
-
-
-  struct asn1_data_node_st
+
+  typedef struct node_asn_struct node_asn;
+
+  typedef node_asn *ASN1_TYPE;
+
+#define ASN1_TYPE_EMPTY  NULL
+
+  struct static_struct_asn
   {
-    const char *name;		/* Node name */
-    const void *value;		/* Node value */
-    unsigned int value_len;	/* Node value size */
-    unsigned int type;		/* Node value type (ASN1_ETYPE_*) */
+    const char *name;			/* Node name */
+    unsigned int type;		/* Node type */
+    const void *value;	/* Node value */
   };
-  typedef struct asn1_data_node_st asn1_data_node_st;
 
-  /***********************************/
-  /*  Fixed constants                */
-  /***********************************/
+  typedef struct static_struct_asn ASN1_ARRAY_TYPE;
 
-
-  /* maximum number of characters */
-  /* of a description message     */
-  /* (null character included)    */
-#define ASN1_MAX_ERROR_DESCRIPTION_SIZE 128
+#endif /* LIBTASN1_COMPAT_WRAPPER */
 
   /***********************************/
   /*  Functions definitions          */
   /***********************************/
 
-  extern ASN1_API int
-    asn1_parser2tree (const char *file,
-		      asn1_node * definitions, char *error_desc);
+  ASN1_API asn1_retCode asn1_parser2tree (const char *file_name,
+				 ASN1_TYPE * definitions,
+				 char *errorDescription);
 
-  extern ASN1_API int
-    asn1_parser2array (const char *inputFileName,
-		       const char *outputFileName,
-		       const char *vectorName, char *error_desc);
+  ASN1_API asn1_retCode asn1_parser2array (const char *inputFileName,
+				  const char *outputFileName,
+				  const char *vectorName,
+				  char *errorDescription);
 
-  extern ASN1_API int
-    asn1_array2tree (const asn1_static_node * array,
-		     asn1_node * definitions, char *errorDescription);
+  ASN1_API asn1_retCode asn1_array2tree (const ASN1_ARRAY_TYPE * array,
+				ASN1_TYPE * definitions,
+				char *errorDescription);
 
-  extern ASN1_API void
-    asn1_print_structure (FILE * out, asn1_node structure,
-			  const char *name, int mode);
+  ASN1_API void asn1_print_structure (FILE *out, ASN1_TYPE structure, const char *name,
+			     int mode);
 
-  extern ASN1_API int
-    asn1_create_element (asn1_node definitions,
-			 const char *source_name, asn1_node * element);
+  ASN1_API asn1_retCode asn1_create_element (ASN1_TYPE definitions,
+				    const char *source_name,
+				    ASN1_TYPE * element);
 
-  extern ASN1_API int asn1_delete_structure (asn1_node * structure);
+  ASN1_API asn1_retCode asn1_delete_structure (ASN1_TYPE * structure);
 
-  extern ASN1_API int asn1_delete_structure2 (asn1_node * structure, unsigned int flags);
+  ASN1_API asn1_retCode asn1_delete_element (ASN1_TYPE structure,
+				    const char *element_name);
 
-  extern ASN1_API int
-    asn1_delete_element (asn1_node structure, const char *element_name);
+  ASN1_API asn1_retCode asn1_write_value (ASN1_TYPE node_root, const char *name,
+				 const void *ivalue, int len);
 
-  extern ASN1_API int
-    asn1_write_value (asn1_node node_root, const char *name,
-		      const void *ivalue, int len);
+  ASN1_API asn1_retCode asn1_read_value (ASN1_TYPE root, const char *name,
+				void *ivalue, int *len);
 
-  extern ASN1_API int
-    asn1_read_value (asn1_node root, const char *name,
-		     void *ivalue, int *len);
+  ASN1_API asn1_retCode asn1_number_of_elements (ASN1_TYPE element, const char *name,
+					int *num);
 
-  extern ASN1_API int
-    asn1_read_value_type (asn1_node root, const char *name,
-			  void *ivalue, int *len, unsigned int *etype);
+  ASN1_API asn1_retCode asn1_der_coding (ASN1_TYPE element, const char *name,
+				void *ider, int *len, char *ErrorDescription);
 
-  extern ASN1_API int
-    asn1_read_node_value (asn1_node node, asn1_data_node_st * data);
+  ASN1_API asn1_retCode asn1_der_decoding (ASN1_TYPE * element, const void *ider,
+				  int len, char *errorDescription);
 
-  extern ASN1_API int
-    asn1_number_of_elements (asn1_node element, const char *name, int *num);
+  ASN1_API asn1_retCode asn1_der_decoding_element (ASN1_TYPE * structure,
+					  const char *elementName,
+					  const void *ider, int len,
+					  char *errorDescription);
 
-  extern ASN1_API int
-    asn1_der_coding (asn1_node element, const char *name,
-		     void *ider, int *len, char *ErrorDescription);
+  ASN1_API asn1_retCode asn1_der_decoding_startEnd (ASN1_TYPE element,
+					   const void *ider, int len,
+					   const char *name_element,
+					   int *start, int *end);
 
-  extern ASN1_API int
-    asn1_der_decoding (asn1_node * element, const void *ider,
-		       int len, char *errorDescription);
+  ASN1_API asn1_retCode asn1_expand_any_defined_by (ASN1_TYPE definitions,
+					   ASN1_TYPE * element);
 
-  /* Do not use. Use asn1_der_decoding() instead. */
-  extern ASN1_API int
-    asn1_der_decoding_element (asn1_node * structure,
-			       const char *elementName,
-			       const void *ider, int len,
-			       char *errorDescription) _ASN1_GCC_ATTR_DEPRECATED;
+  ASN1_API asn1_retCode asn1_expand_octet_string (ASN1_TYPE definitions,
+					 ASN1_TYPE * element,
+					 const char *octetName,
+					 const char *objectName);
 
-  extern ASN1_API int
-    asn1_der_decoding_startEnd (asn1_node element,
-				const void *ider, int len,
-				const char *name_element,
-				int *start, int *end);
+  ASN1_API asn1_retCode asn1_read_tag (node_asn * root, const char *name,
+			      int *tagValue, int *classValue);
 
-  extern ASN1_API int
-    asn1_expand_any_defined_by (asn1_node definitions, asn1_node * element);
+  ASN1_API const char *asn1_find_structure_from_oid (ASN1_TYPE definitions,
+					    const char *oidValue);
 
-  extern ASN1_API int
-    asn1_expand_octet_string (asn1_node definitions,
-			      asn1_node * element,
-			      const char *octetName, const char *objectName);
+  ASN1_API const char *asn1_check_version (const char *req_version);
 
-  extern ASN1_API int
-    asn1_read_tag (asn1_node root, const char *name,
-		   int *tagValue, int *classValue);
+  ASN1_API const char *libtasn1_strerror (asn1_retCode error);
 
-  extern ASN1_API const char *asn1_find_structure_from_oid (asn1_node
-							    definitions,
-							    const char
-							    *oidValue);
+  ASN1_API void libtasn1_perror (asn1_retCode error);
 
-  extern ASN1_API const char *asn1_check_version (const char *req_version);
+  /* DER utility functions. */
 
-  extern ASN1_API const char *asn1_strerror (int error);
+  ASN1_API int asn1_get_tag_der (const unsigned char *der, int der_len,
+			unsigned char *cls, int *len, unsigned long *tag);
 
-  extern ASN1_API void asn1_perror (int error);
+  ASN1_API void asn1_octet_der (const unsigned char *str, int str_len,
+		       unsigned char *der, int *der_len);
 
-#define ASN1_MAX_TAG_SIZE 4
-#define ASN1_MAX_LENGTH_SIZE 9
-#define ASN1_MAX_TL_SIZE (ASN1_MAX_TAG_SIZE+ASN1_MAX_LENGTH_SIZE)
-  extern ASN1_API long
-    asn1_get_length_der (const unsigned char *der, int der_len, int *len);
+  ASN1_API asn1_retCode asn1_get_octet_der (const unsigned char *der, int der_len,
+				   int *ret_len, unsigned char *str,
+				   int str_size, int *str_len);
 
-  extern ASN1_API long
-    asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len);
+  ASN1_API void asn1_bit_der (const unsigned char *str, int bit_len,
+		     unsigned char *der, int *der_len);
 
-  extern ASN1_API void
-    asn1_length_der (unsigned long int len, unsigned char *der, int *der_len);
+  ASN1_API asn1_retCode asn1_get_bit_der (const unsigned char *der, int der_len,
+				 int *ret_len, unsigned char *str,
+				 int str_size, int *bit_len);
 
-  /* Other utility functions. */
+  ASN1_API signed long asn1_get_length_der (const unsigned char *der, int der_len,
+				   int *len);
 
-  extern ASN1_API
-    int asn1_decode_simple_der (unsigned int etype, const unsigned char *der,
-				unsigned int der_len,
-				const unsigned char **str,
-				unsigned int *str_len);
+  ASN1_API void asn1_length_der (unsigned long int len, unsigned char *ans,
+			int *ans_len);
 
-  extern ASN1_API int
-    asn1_encode_simple_der (unsigned int etype, const unsigned char *str,
-			    unsigned int str_len, unsigned char *tl,
-			    unsigned int *tl_len);
-
-  extern ASN1_API asn1_node
-    asn1_find_node (asn1_node pointer, const char *name);
-
-  extern ASN1_API int
-    asn1_copy_node (asn1_node dst, const char *dst_name,
-		    asn1_node src, const char *src_name);
-
-  /* Internal and low-level DER utility functions. */
-
-  extern ASN1_API int
-    asn1_get_tag_der (const unsigned char *der, int der_len,
-		      unsigned char *cls, int *len, unsigned long *tag);
-
-  extern ASN1_API void
-    asn1_octet_der (const unsigned char *str, int str_len,
-		    unsigned char *der, int *der_len);
-
-  extern ASN1_API int
-    asn1_get_octet_der (const unsigned char *der, int der_len,
-			int *ret_len, unsigned char *str,
-			int str_size, int *str_len);
-
-  extern ASN1_API void asn1_bit_der (const unsigned char *str, int bit_len,
-				     unsigned char *der, int *der_len);
-
-  extern ASN1_API int
-    asn1_get_bit_der (const unsigned char *der, int der_len,
-		      int *ret_len, unsigned char *str,
-		      int str_size, int *bit_len);
-
-/* Compatibility types */
-
-  typedef int asn1_retCode;	/* type returned by libtasn1 functions */
-
-#define node_asn_struct asn1_node_st
-#define node_asn asn1_node_st
-#define ASN1_TYPE asn1_node
-#define ASN1_TYPE_EMPTY NULL
+  /* Other utility functions. */
 
-#define static_struct_asn asn1_static_node_st
-#define ASN1_ARRAY_TYPE asn1_static_node
-#define asn1_static_node_t asn1_static_node
+  ASN1_API ASN1_TYPE asn1_find_node (ASN1_TYPE pointer, const char *name);
 
-#define node_data_struct asn1_data_node_st
-#define ASN1_DATA_NODE asn1_data_node_st
+  ASN1_API asn1_retCode asn1_copy_node (ASN1_TYPE dst, const char *dst_name,
+			       ASN1_TYPE src, const char *src_name);
 
 #ifdef __cplusplus
 }
diff --git a/lib/libtasn1.map b/lib/libtasn1.map
index fa91638..3bb5cf8 100644
--- a/lib/libtasn1.map
+++ b/lib/libtasn1.map
@@ -43,17 +43,54 @@ LIBTASN1_0_3
     asn1_octet_der;
     asn1_parser2array;
     asn1_parser2tree;
-    asn1_perror;
     asn1_print_structure;
     asn1_read_tag;
     asn1_read_value;
-    asn1_strerror;
     asn1_write_value;
     asn1_read_node_value;
     asn1_encode_simple_der;
     asn1_decode_simple_der;
     asn1_read_value_type;
     asn1_delete_structure2;
+    libtasn1_strerror;
+    libtasn1_perror;
+
+    asn1_internal_array2tree;
+    asn1_internal_bit_der;
+    asn1_internal_check_version;
+    asn1_internal_copy_node;
+    asn1_internal_create_element;
+    asn1_internal_delete_element;
+    asn1_internal_delete_structure;
+    asn1_internal_der_coding;
+    asn1_internal_der_decoding;
+    asn1_internal_der_decoding_element;
+    asn1_internal_der_decoding_startEnd;
+    asn1_internal_expand_any_defined_by;
+    asn1_internal_expand_octet_string;
+    asn1_internal_find_node;
+    asn1_internal_find_structure_from_oid;
+    asn1_internal_get_bit_der;
+    asn1_internal_get_length_ber;
+    asn1_internal_get_length_der;
+    asn1_internal_get_octet_der;
+    asn1_internal_get_tag_der;
+    asn1_internal_length_der;
+    asn1_internal_number_of_elements;
+    asn1_internal_octet_der;
+    asn1_internal_parser2array;
+    asn1_internal_parser2tree;
+    asn1_internal_perror;
+    asn1_internal_print_structure;
+    asn1_internal_read_tag;
+    asn1_internal_read_value;
+    asn1_internal_strerror;
+    asn1_internal_write_value;
+    asn1_internal_read_node_value;
+    asn1_internal_encode_simple_der;
+    asn1_internal_decode_simple_der;
+    asn1_internal_read_value_type;
+    asn1_internal_delete_structure2;
   local:
     *;
 };
diff --git a/lib/parser_aux.c b/lib/parser_aux.c
index effedb2..5e3aa96 100644
--- a/lib/parser_aux.c
+++ b/lib/parser_aux.c
@@ -91,7 +91,7 @@ _asn1_add_static_node (unsigned int type)
  * Returns: the search result, or %NULL if not found.
  **/
 asn1_node
-asn1_find_node (asn1_node pointer, const char *name)
+asn1_internal_find_node (asn1_node pointer, const char *name)
 {
   asn1_node p;
   char *n_end, n[ASN1_MAX_NAME_SIZE + 1];
@@ -260,12 +260,12 @@ _asn1_set_value_lv (asn1_node node, const void *value, unsigned int len)
   if (node == NULL)
     return node;
 
-  asn1_length_der (len, NULL, &len2);
+  asn1_internal_length_der (len, NULL, &len2);
   temp = malloc (len + len2);
   if (temp == NULL)
     return NULL;
 
-  asn1_octet_der (value, len, temp, &len2);
+  asn1_internal_octet_der (value, len, temp, &len2);
   return _asn1_set_value_m (node, temp, len2);
 }
 
@@ -596,7 +596,7 @@ _asn1_change_integer_value (asn1_node node)
 	  if (p->value)
 	    {
 	      _asn1_convert_integer (p->value, val, sizeof (val), &len);
-	      asn1_octet_der (val, len, val2, &len);
+	      asn1_internal_octet_der (val, len, val2, &len);
 	      _asn1_set_value (p, val2, len);
 	    }
 	}
@@ -675,7 +675,7 @@ _asn1_expand_object_id (asn1_node node)
 		      _asn1_str_cat (name2, sizeof (name2), ".");
 		      _asn1_str_cat (name2, sizeof (name2),
 				     (char *) p2->value);
-		      p3 = asn1_find_node (node, name2);
+		      p3 = asn1_internal_find_node (node, name2);
 		      if (!p3
 			  || (type_field (p3->type) != ASN1_ETYPE_OBJECT_ID)
 			  || !(p3->type & CONST_ASSIGN))
@@ -763,7 +763,7 @@ _asn1_expand_object_id (asn1_node node)
 		  _asn1_str_cpy (name2, sizeof (name2), name_root);
 		  _asn1_str_cat (name2, sizeof (name2), ".");
 		  _asn1_str_cat (name2, sizeof (name2), (char *) p2->value);
-		  p3 = asn1_find_node (node, name2);
+		  p3 = asn1_internal_find_node (node, name2);
 		  if (!p3 || (type_field (p3->type) != ASN1_ETYPE_OBJECT_ID)
 		      || !(p3->type & CONST_ASSIGN))
 		    return ASN1_ELEMENT_NOT_FOUND;
@@ -919,7 +919,7 @@ _asn1_check_identifier (asn1_node node)
 	  _asn1_str_cpy (name2, sizeof (name2), node->name);
 	  _asn1_str_cat (name2, sizeof (name2), ".");
 	  _asn1_str_cat (name2, sizeof (name2), (char *) p->value);
-	  p2 = asn1_find_node (node, name2);
+	  p2 = asn1_internal_find_node (node, name2);
 	  if (p2 == NULL)
 	    {
 	      if (p->value)
@@ -939,7 +939,7 @@ _asn1_check_identifier (asn1_node node)
 	      _asn1_str_cat (name2, sizeof (name2), ".");
 	      _asn1_str_cat (name2, sizeof (name2), (char *) p2->value);
 	      _asn1_strcpy (_asn1_identifierMissing, p2->value);
-	      p2 = asn1_find_node (node, name2);
+	      p2 = asn1_internal_find_node (node, name2);
 	      if (!p2 || (type_field (p2->type) != ASN1_ETYPE_OBJECT_ID) ||
 		  !(p2->type & CONST_ASSIGN))
 		return ASN1_IDENTIFIER_NOT_FOUND;
@@ -959,7 +959,7 @@ _asn1_check_identifier (asn1_node node)
 		  _asn1_str_cat (name2, sizeof (name2), ".");
 		  _asn1_str_cat (name2, sizeof (name2), (char *) p2->value);
 		  _asn1_strcpy (_asn1_identifierMissing, p2->value);
-		  p2 = asn1_find_node (node, name2);
+		  p2 = asn1_internal_find_node (node, name2);
 		  if (!p2 || (type_field (p2->type) != ASN1_ETYPE_OBJECT_ID)
 		      || !(p2->type & CONST_ASSIGN))
 		    return ASN1_IDENTIFIER_NOT_FOUND;
diff --git a/lib/structure.c b/lib/structure.c
index 27fbfe3..73ae311 100644
--- a/lib/structure.c
+++ b/lib/structure.c
@@ -94,7 +94,7 @@ _asn1_create_static_structure (asn1_node pointer, char *output_file_name,
   fprintf (file, "# include \"config.h\"\n");
   fprintf (file, "#endif\n\n");
 
-  fprintf (file, "#include <libtasn1.h>\n\n");
+  fprintf (file, "#include <libtasn1-internal.h>\n\n");
 
   fprintf (file, "const asn1_static_node %s[] = {\n", vector_name);
 
@@ -174,8 +174,8 @@ _asn1_create_static_structure (asn1_node pointer, char *output_file_name,
  *   %ASN1_ARRAY_ERROR if the array pointed by @array is wrong.
  **/
 int
-asn1_array2tree (const asn1_static_node * array, asn1_node * definitions,
-		 char *errorDescription)
+asn1_internal_array2tree (const asn1_static_node * array, asn1_node * definitions,
+			  char *errorDescription)
 {
   asn1_node p, p_last = NULL;
   unsigned long k;
@@ -285,9 +285,9 @@ asn1_array2tree (const asn1_static_node * array, asn1_node * definitions,
  *   *@structure was NULL.
  **/
 int
-asn1_delete_structure (asn1_node * structure)
+asn1_internal_delete_structure (asn1_node * structure)
 {
-  return asn1_delete_structure2(structure, 0);
+  return asn1_internal_delete_structure2(structure, 0);
 }
 
 /**
@@ -302,7 +302,7 @@ asn1_delete_structure (asn1_node * structure)
  *   *@structure was NULL.
  **/
 int
-asn1_delete_structure2 (asn1_node * structure, unsigned int flags)
+asn1_internal_delete_structure2 (asn1_node * structure, unsigned int flags)
 {
   asn1_node p, p2, p3;
 
@@ -366,11 +366,11 @@ asn1_delete_structure2 (asn1_node * structure, unsigned int flags)
  *   the @element_name was not found.
  **/
 int
-asn1_delete_element (asn1_node structure, const char *element_name)
+asn1_internal_delete_element (asn1_node structure, const char *element_name)
 {
   asn1_node p2, p3, source_node;
 
-  source_node = asn1_find_node (structure, element_name);
+  source_node = asn1_internal_find_node (structure, element_name);
 
   if (source_node == NULL)
     return ASN1_ELEMENT_NOT_FOUND;
@@ -388,7 +388,7 @@ asn1_delete_element (asn1_node structure, const char *element_name)
   else
     _asn1_set_right (p3, p2);
 
-  return asn1_delete_structure (&source_node);
+  return asn1_internal_delete_structure (&source_node);
 }
 
 asn1_node
@@ -454,7 +454,7 @@ _asn1_copy_structure2 (asn1_node root, const char *source_name)
 {
   asn1_node source_node;
 
-  source_node = asn1_find_node (root, source_name);
+  source_node = asn1_internal_find_node (root, source_name);
 
   return _asn1_copy_structure3 (source_node);
 
@@ -509,7 +509,7 @@ _asn1_type_choice_config (asn1_node node)
 		{
 		  p3 = p2->right;
 		  if (type_field (p2->type) == ASN1_ETYPE_TAG)
-		    asn1_delete_structure (&p2);
+		    asn1_internal_delete_structure (&p2);
 		  p2 = p3;
 		}
 	    }
@@ -670,8 +670,8 @@ _asn1_expand_identifier (asn1_node * node, asn1_node root)
  *   @source_name is not known.
  **/
 int
-asn1_create_element (asn1_node definitions, const char *source_name,
-		     asn1_node * element)
+asn1_internal_create_element (asn1_node definitions, const char *source_name,
+			      asn1_node * element)
 {
   asn1_node dest_node;
   int res;
@@ -705,8 +705,8 @@ asn1_create_element (asn1_node definitions, const char *source_name,
  * from the @name element inside the structure @structure.
  **/
 void
-asn1_print_structure (FILE * out, asn1_node structure, const char *name,
-		      int mode)
+asn1_internal_print_structure (FILE * out, asn1_node structure, const char *name,
+			       int mode)
 {
   asn1_node p, root;
   int k, indent = 0, len, len2, len3;
@@ -714,7 +714,7 @@ asn1_print_structure (FILE * out, asn1_node structure, const char *name,
   if (out == NULL)
     return;
 
-  root = asn1_find_node (structure, name);
+  root = asn1_internal_find_node (structure, name);
 
   if (root == NULL)
     return;
@@ -826,7 +826,7 @@ asn1_print_structure (FILE * out, asn1_node structure, const char *name,
 	      if (p->value)
 		{
 		  len2 = -1;
-		  len = asn1_get_length_der (p->value, p->value_len, &len2);
+		  len = asn1_internal_get_length_der (p->value, p->value_len, &len2);
 		  fprintf (out, "  value:0x");
 		  if (len > 0)
 		    for (k = 0; k < len; k++)
@@ -837,7 +837,7 @@ asn1_print_structure (FILE * out, asn1_node structure, const char *name,
 	      if (p->value)
 		{
 		  len2 = -1;
-		  len = asn1_get_length_der (p->value, p->value_len, &len2);
+		  len = asn1_internal_get_length_der (p->value, p->value_len, &len2);
 		  fprintf (out, "  value:0x");
 		  if (len > 0)
 		    for (k = 0; k < len; k++)
@@ -857,7 +857,7 @@ asn1_print_structure (FILE * out, asn1_node structure, const char *name,
 	      if (p->value)
 		{
 		  len2 = -1;
-		  len = asn1_get_length_der (p->value, p->value_len, &len2);
+		  len = asn1_internal_get_length_der (p->value, p->value_len, &len2);
 		  if (len > 0)
 		    {
 		      fprintf (out, "  value(%i):",
@@ -887,7 +887,7 @@ asn1_print_structure (FILE * out, asn1_node structure, const char *name,
 	      if (p->value)
 		{
 		  len2 = -1;
-		  len = asn1_get_length_der (p->value, p->value_len, &len2);
+		  len = asn1_internal_get_length_der (p->value, p->value_len, &len2);
 		  fprintf (out, "  value:");
 		  if (len > 0)
 		    for (k = 0; k < len; k++)
@@ -899,7 +899,7 @@ asn1_print_structure (FILE * out, asn1_node structure, const char *name,
 	      if (p->value)
 		{
 		  len2 = -1;
-		  len = asn1_get_length_der (p->value, p->value_len, &len2);
+		  len = asn1_internal_get_length_der (p->value, p->value_len, &len2);
 		  fprintf (out, "  value:");
 		  if (len > 0)
 		    for (k = 0; k < len; k++)
@@ -914,7 +914,7 @@ asn1_print_structure (FILE * out, asn1_node structure, const char *name,
 	      if (p->value)
 		{
 		  len3 = -1;
-		  len2 = asn1_get_length_der (p->value, p->value_len, &len3);
+		  len2 = asn1_internal_get_length_der (p->value, p->value_len, &len3);
 		  fprintf (out, "  value:");
 		  if (len2 > 0)
 		    for (k = 0; k < len2; k++)
@@ -1047,7 +1047,7 @@ asn1_print_structure (FILE * out, asn1_node structure, const char *name,
  *   @name is not known, %ASN1_GENERIC_ERROR if pointer @num is %NULL.
  **/
 int
-asn1_number_of_elements (asn1_node element, const char *name, int *num)
+asn1_internal_number_of_elements (asn1_node element, const char *name, int *num)
 {
   asn1_node node, p;
 
@@ -1056,7 +1056,7 @@ asn1_number_of_elements (asn1_node element, const char *name, int *num)
 
   *num = 0;
 
-  node = asn1_find_node (element, name);
+  node = asn1_internal_find_node (element, name);
   if (node == NULL)
     return ASN1_ELEMENT_NOT_FOUND;
 
@@ -1085,7 +1085,7 @@ asn1_number_of_elements (asn1_node element, const char *name, int *num)
  *   the OID.
  **/
 const char *
-asn1_find_structure_from_oid (asn1_node definitions, const char *oidValue)
+asn1_internal_find_structure_from_oid (asn1_node definitions, const char *oidValue)
 {
   char name[2 * ASN1_MAX_NAME_SIZE + 1];
   char value[ASN1_MAX_NAME_SIZE];
@@ -1109,7 +1109,7 @@ asn1_find_structure_from_oid (asn1_node definitions, const char *oidValue)
           snprintf(name, sizeof(name), "%s.%s", definitionsName, p->name);
 
 	  len = ASN1_MAX_NAME_SIZE;
-	  result = asn1_read_value (definitions, name, value, &len);
+	  result = asn1_internal_read_value (definitions, name, value, &len);
 
 	  if ((result == ASN1_SUCCESS) && (!strcmp (oidValue, value)))
 	    {
@@ -1138,8 +1138,8 @@ asn1_find_structure_from_oid (asn1_node definitions, const char *oidValue)
  * Returns: Return %ASN1_SUCCESS on success.
  **/
 int
-asn1_copy_node (asn1_node dst, const char *dst_name,
-		asn1_node src, const char *src_name)
+asn1_internal_copy_node (asn1_node dst, const char *dst_name,
+			 asn1_node src, const char *src_name)
 {
 /* FIXME: rewrite using copy_structure().
  * It seems quite hard to do.
@@ -1149,7 +1149,7 @@ asn1_copy_node (asn1_node dst, const char *dst_name,
   void *data = NULL;
   int size = 0;
 
-  result = asn1_der_coding (src, src_name, NULL, &size, NULL);
+  result = asn1_internal_der_coding (src, src_name, NULL, &size, NULL);
   if (result != ASN1_MEM_ERROR)
     return result;
 
@@ -1157,21 +1157,21 @@ asn1_copy_node (asn1_node dst, const char *dst_name,
   if (data == NULL)
     return ASN1_MEM_ERROR;
 
-  result = asn1_der_coding (src, src_name, data, &size, NULL);
+  result = asn1_internal_der_coding (src, src_name, data, &size, NULL);
   if (result != ASN1_SUCCESS)
     {
       free (data);
       return result;
     }
 
-  dst_node = asn1_find_node (dst, dst_name);
+  dst_node = asn1_internal_find_node (dst, dst_name);
   if (dst_node == NULL)
     {
       free (data);
       return ASN1_ELEMENT_NOT_FOUND;
     }
 
-  result = asn1_der_decoding (&dst_node, data, size, NULL);
+  result = asn1_internal_der_decoding (&dst_node, data, size, NULL);
 
   free (data);
 
diff --git a/lib/version.c b/lib/version.c
index 25f8a8f..0c09525 100644
--- a/lib/version.c
+++ b/lib/version.c
@@ -25,7 +25,7 @@
 
 #include <string.h>		/* for strverscmp */
 
-#include "libtasn1.h"
+#include "libtasn1-internal.h"
 
 /**
  * asn1_check_version:
@@ -42,7 +42,7 @@
  *   run-time library does not meet the required version number.
  */
 const char *
-asn1_check_version (const char *req_version)
+asn1_internal_check_version (const char *req_version)
 {
   if (!req_version || strverscmp (req_version, ASN1_VERSION) <= 0)
     return ASN1_VERSION;
diff --git a/src/asn1Coding.c b/src/asn1Coding.c
index 650e817..93f75d2 100644
--- a/src/asn1Coding.c
+++ b/src/asn1Coding.c
@@ -26,7 +26,7 @@
 #include <unistd.h>
 #include <getopt.h>
 
-#include <libtasn1.h>
+#include <libtasn1-internal.h>
 
 #include <progname.h>
 #include <version-etc.h>
@@ -206,7 +206,7 @@ main (int argc, char *argv[])
   strcpy (inputFileAssignmentName, argv[optind + 1]);
 
   asn1_result =
-    asn1_parser2tree (inputFileAsnName, &definitions, errorDescription);
+    asn1_internal_parser2tree (inputFileAsnName, &definitions, errorDescription);
 
   switch (asn1_result)
     {
@@ -222,7 +222,7 @@ main (int argc, char *argv[])
       fprintf (stderr, "asn1Coding: %s\n", errorDescription);
       break;
     default:
-      fprintf (stderr, "libtasn1 ERROR: %s\n", asn1_strerror (asn1_result));
+      fprintf (stderr, "libtasn1 ERROR: %s\n", asn1_internal_strerror (asn1_result));
     }
 
   if (asn1_result != ASN1_SUCCESS)
@@ -253,18 +253,18 @@ main (int argc, char *argv[])
       fprintf (stderr, "var=%s, value=%s\n", varName, value);
       if (structure == NULL)
 	{
-	  asn1_result = asn1_create_element (definitions, value, &structure);
+	  asn1_result = asn1_internal_create_element (definitions, value, &structure);
 	}
       else
-	asn1_result = asn1_write_value (structure, varName, value, 0);
+	asn1_result = asn1_internal_write_value (structure, varName, value, 0);
 
       if (asn1_result != ASN1_SUCCESS)
 	{
 	  fprintf (stderr, "libtasn1 ERROR: %s\n",
-		   asn1_strerror (asn1_result));
+		   asn1_internal_strerror (asn1_result));
 
-	  asn1_delete_structure (&definitions);
-	  asn1_delete_structure (&structure);
+	  asn1_internal_delete_structure (&definitions);
+	  asn1_internal_delete_structure (&structure);
 
 	  free (inputFileAsnName);
 	  free (inputFileAssignmentName);
@@ -281,26 +281,26 @@ main (int argc, char *argv[])
   fclose (inputFile);
 
   putc ('\n', stderr);
-  asn1_print_structure (stderr, structure, "", ASN1_PRINT_NAME_TYPE_VALUE);
+  asn1_internal_print_structure (stderr, structure, "", ASN1_PRINT_NAME_TYPE_VALUE);
 
   der_len = 0;
-  asn1_result = asn1_der_coding (structure, "", der, &der_len,
+  asn1_result = asn1_internal_der_coding (structure, "", der, &der_len,
 				 errorDescription);
   if (asn1_result == ASN1_MEM_ERROR)
     {
       der = malloc (der_len);
-      asn1_result = asn1_der_coding (structure, "", der, &der_len,
+      asn1_result = asn1_internal_der_coding (structure, "", der, &der_len,
 				     errorDescription);
     }
-  fprintf (stderr, "\nCoding: %s\n\n", asn1_strerror (asn1_result));
+  fprintf (stderr, "\nCoding: %s\n\n", asn1_internal_strerror (asn1_result));
   if (asn1_result != ASN1_SUCCESS)
     {
       fprintf (stderr, "asn1Coding: %s\n", errorDescription);
 
       free (der);
 
-      asn1_delete_structure (&definitions);
-      asn1_delete_structure (&structure);
+      asn1_internal_delete_structure (&definitions);
+      asn1_internal_delete_structure (&structure);
 
       free (inputFileAsnName);
       free (inputFileAssignmentName);
@@ -314,8 +314,8 @@ main (int argc, char *argv[])
     fprintf (stderr, "%02x ", der[k]);
   fputs ("\n-----------------\n", stderr);
 
-  asn1_delete_structure (&definitions);
-  asn1_delete_structure (&structure);
+  asn1_internal_delete_structure (&definitions);
+  asn1_internal_delete_structure (&structure);
 
   if (!checkSyntaxOnly)
     {
diff --git a/src/asn1Decoding.c b/src/asn1Decoding.c
index 5649990..2b7ab43 100644
--- a/src/asn1Decoding.c
+++ b/src/asn1Decoding.c
@@ -26,7 +26,7 @@
 #include <unistd.h>
 #include <getopt.h>
 
-#include <libtasn1.h>
+#include <libtasn1-internal.h>
 
 #include <progname.h>
 #include <version-etc.h>
@@ -140,7 +140,7 @@ main (int argc, char *argv[])
   strcpy (typeName, argv[optind + 2]);
 
   asn1_result =
-    asn1_parser2tree (inputFileAsnName, &definitions, errorDescription);
+    asn1_internal_parser2tree (inputFileAsnName, &definitions, errorDescription);
 
   switch (asn1_result)
     {
@@ -156,7 +156,7 @@ main (int argc, char *argv[])
       fprintf (stderr, "asn1Decoding: %s\n", errorDescription);
       break;
     default:
-      fprintf (stderr, "libtasn1 ERROR: %s\n", asn1_strerror (asn1_result));
+      fprintf (stderr, "libtasn1 ERROR: %s\n", asn1_internal_strerror (asn1_result));
     }
 
   if (asn1_result != ASN1_SUCCESS)
@@ -178,7 +178,7 @@ main (int argc, char *argv[])
     {
       fprintf (stderr, "asn1Decoding: could not read '%s'\n",
 	       inputFileDerName);
-      asn1_delete_structure (&definitions);
+      asn1_internal_delete_structure (&definitions);
 
       free (inputFileAsnName);
       free (inputFileDerName);
@@ -204,7 +204,7 @@ main (int argc, char *argv[])
 
   if (decode (definitions, typeName, der, der_len, benchmark) != ASN1_SUCCESS)
     {
-      asn1_delete_structure (&definitions);
+      asn1_internal_delete_structure (&definitions);
       free (inputFileAsnName);
       free (inputFileDerName);
       free (typeName);
@@ -212,7 +212,7 @@ main (int argc, char *argv[])
       exit (1);
     }
 
-  asn1_delete_structure (&definitions);
+  asn1_internal_delete_structure (&definitions);
 
   free (der);
 
@@ -235,38 +235,38 @@ simple_decode (asn1_node definitions, const char *typeName, void *der,
   asn1_node structure = NULL;
   char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE];
 
-  asn1_result = asn1_create_element (definitions, typeName, &structure);
+  asn1_result = asn1_internal_create_element (definitions, typeName, &structure);
 
-  /* asn1_print_structure(stdout,structure,"",ASN1_PRINT_ALL); */
+  /* asn1_internal_print_structure(stdout,structure,"",ASN1_PRINT_ALL); */
 
 
   if (asn1_result != ASN1_SUCCESS)
     {
       fprintf (stderr, "Structure creation: %s\n",
-	       asn1_strerror (asn1_result));
-      asn1_delete_structure (&structure);
+	       asn1_internal_strerror (asn1_result));
+      asn1_internal_delete_structure (&structure);
       return asn1_result;
     }
 
   asn1_result =
-    asn1_der_decoding (&structure, der, der_len, errorDescription);
+    asn1_internal_der_decoding (&structure, der, der_len, errorDescription);
 
   if (!benchmark)
-    fprintf (stderr, "\nDecoding: %s\n", asn1_strerror (asn1_result));
+    fprintf (stderr, "\nDecoding: %s\n", asn1_internal_strerror (asn1_result));
   if (asn1_result != ASN1_SUCCESS)
     {
       fprintf (stderr, "asn1Decoding: %s\n", errorDescription);
-      asn1_delete_structure (&structure);
+      asn1_internal_delete_structure (&structure);
       return asn1_result;
     }
 
   if (!benchmark)
     {
       fprintf (stderr, "\nDECODING RESULT:\n");
-      asn1_print_structure (stdout, structure, "",
-			    ASN1_PRINT_NAME_TYPE_VALUE);
+      asn1_internal_print_structure (stdout, structure, "",
+				     ASN1_PRINT_NAME_TYPE_VALUE);
     }
-  asn1_delete_structure (&structure);
+  asn1_internal_delete_structure (&structure);
   return ASN1_SUCCESS;
 }
 
diff --git a/src/asn1Parser.c b/src/asn1Parser.c
index 7a3ae67..bd49550 100644
--- a/src/asn1Parser.c
+++ b/src/asn1Parser.c
@@ -26,7 +26,7 @@
 #include <unistd.h>
 #include <getopt.h>
 
-#include <libtasn1.h>
+#include <libtasn1-internal.h>
 
 #include <progname.h>
 #include <version-etc.h>
@@ -159,13 +159,13 @@ main (int argc, char *argv[])
   if (checkSyntaxOnly == 1)
     {
       parse_result =
-	asn1_parser2tree (inputFileName, &pointer, errorDescription);
-      asn1_delete_structure (&pointer);
+	asn1_internal_parser2tree (inputFileName, &pointer, errorDescription);
+      asn1_internal_delete_structure (&pointer);
     }
   else				/* C VECTOR CREATION */
-    parse_result = asn1_parser2array (inputFileName,
-				      outputFileName, vectorName,
-				      errorDescription);
+    parse_result = asn1_internal_parser2array (inputFileName,
+					       outputFileName, vectorName,
+					       errorDescription);
 
   switch (parse_result)
     {
@@ -181,7 +181,7 @@ main (int argc, char *argv[])
       fprintf (stderr, "asn1Parser: %s\n", errorDescription);
       break;
     default:
-      fprintf (stderr, "libtasn1 ERROR: %s\n", asn1_strerror (parse_result));
+      fprintf (stderr, "libtasn1 ERROR: %s\n", asn1_internal_strerror (parse_result));
     }
 
 
diff --git a/tests/Test_choice.c b/tests/Test_choice.c
index 07da57e..1e9384f 100644
--- a/tests/Test_choice.c
+++ b/tests/Test_choice.c
@@ -1,6 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <libtasn1.h>
+#include <libtasn1-internal.h>
 
 int
 main (int argc, char** argv)
@@ -13,59 +13,59 @@ main (int argc, char** argv)
   int data_size = sizeof (data);
 
   /* Encode */
-  result = asn1_parser2tree ("choice.asn", &definitions, errorDescription);
+  result = asn1_internal_parser2tree ("choice.asn", &definitions, errorDescription);
   if (result != ASN1_SUCCESS)
     {
       printf ("error in %d\n", __LINE__);
       exit (1);
     }
 
-  result = asn1_create_element (definitions, "TEST.Choice0", &node1);
+  result = asn1_internal_create_element (definitions, "TEST.Choice0", &node1);
   if (result != ASN1_SUCCESS)
     {
       printf ("error in %d\n", __LINE__);
       exit (1);
     }
 
-  result = asn1_write_value (node1, "", "choice1", 1);
+  result = asn1_internal_write_value (node1, "", "choice1", 1);
   if (result != ASN1_SUCCESS)
     {
       printf ("error in %d\n", __LINE__);
       exit (1);
     }
 
-  result = asn1_write_value (node1, "choice1", "choice2", 1);
+  result = asn1_internal_write_value (node1, "choice1", "choice2", 1);
   if (result != ASN1_SUCCESS)
     {
       printf ("error in %d\n", __LINE__);
       exit (1);
     }
 
-  result = asn1_write_value (node1, "choice1.choice2", "int1", 1);
+  result = asn1_internal_write_value (node1, "choice1.choice2", "int1", 1);
   if (result != ASN1_SUCCESS)
     {
       printf ("error in %d\n", __LINE__);
       exit (1);
     }
 
-  result = asn1_write_value (node1, "choice1.choice2.int1", "1234", 0);
+  result = asn1_internal_write_value (node1, "choice1.choice2.int1", "1234", 0);
   if (result != ASN1_SUCCESS)
     {
       printf ("error in %d\n", __LINE__);
       exit (1);
     }
 
-  result = asn1_der_coding (node1, "", data, &data_size, errorDescription);
+  result = asn1_internal_der_coding (node1, "", data, &data_size, errorDescription);
   if (result != ASN1_SUCCESS)
     {
       printf ("error in %d\n", __LINE__);
       exit (1);
     }
 
-  asn1_delete_structure (&node1);
+  asn1_internal_delete_structure (&node1);
 
   /* Decode */
-  result = asn1_create_element (definitions, "TEST.Choice0", &node2);
+  result = asn1_internal_create_element (definitions, "TEST.Choice0", &node2);
   if (result != ASN1_SUCCESS)
     {
       printf ("error in %d\n", __LINE__);
@@ -79,15 +79,15 @@ main (int argc, char** argv)
   printf ("\n");
 #endif
 
-  result = asn1_der_decoding (&node2, data, data_size, errorDescription);
+  result = asn1_internal_der_decoding (&node2, data, data_size, errorDescription);
   if (result != ASN1_SUCCESS)
     {
       printf ("error in %d\n", __LINE__);
       exit (1);
     }
 
-  asn1_delete_structure (&node2);
-  asn1_delete_structure (&definitions);
+  asn1_internal_delete_structure (&node2);
+  asn1_internal_delete_structure (&definitions);
 
   return 0;
 }
diff --git a/tests/Test_encdec.c b/tests/Test_encdec.c
index 363f2ff..900b704 100644
--- a/tests/Test_encdec.c
+++ b/tests/Test_encdec.c
@@ -32,7 +32,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include "libtasn1.h"
+#include "libtasn1-internal.h"
 
 
 
@@ -70,14 +70,14 @@ main (int argc, char *argv[])
     }
 
   /* Check version */
-  if (asn1_check_version ("0.3.3") == NULL)
+  if (asn1_internal_check_version ("0.3.3") == NULL)
     printf ("\nLibrary version check ERROR:\n actual version: %s\n\n",
-	    asn1_check_version (NULL));
+	    asn1_internal_check_version (NULL));
 
-  result = asn1_parser2tree (treefile, &definitions, errorDescription);
+  result = asn1_internal_parser2tree (treefile, &definitions, errorDescription);
   if (result != ASN1_SUCCESS)
     {
-      asn1_perror (result);
+      asn1_internal_perror (result);
       printf ("ErrorDescription = %s\n\n", errorDescription);
       exit (1);
     }
@@ -100,27 +100,27 @@ main (int argc, char *argv[])
   fclose (fd);
 
   result =
-    asn1_create_element (definitions, "PKIX1.CertificateList", &asn1_element);
+    asn1_internal_create_element (definitions, "PKIX1.CertificateList", &asn1_element);
   if (result != ASN1_SUCCESS)
     {
-      asn1_perror (result);
+      asn1_internal_perror (result);
       printf ("Cannot create CRL element\n");
       exit (1);
     }
 
-  result = asn1_der_decoding (&asn1_element, buffer, size, errorDescription);
+  result = asn1_internal_der_decoding (&asn1_element, buffer, size, errorDescription);
   if (result != ASN1_SUCCESS)
     {
-      asn1_perror (result);
+      asn1_internal_perror (result);
       printf ("Cannot decode DER data (size %ld)\n", (long) size);
       exit (1);
     }
 
   size2 = sizeof(buffer2);
-  result = asn1_der_coding (asn1_element, "", buffer2, &size2, NULL);
+  result = asn1_internal_der_coding (asn1_element, "", buffer2, &size2, NULL);
   if (result != ASN1_SUCCESS)
     {
-      asn1_perror (result);
+      asn1_internal_perror (result);
       printf ("Cannot encode data (size %ld)\n", (long) size);
       exit (1);
     }
@@ -132,8 +132,8 @@ main (int argc, char *argv[])
     }
 
   /* Clear the definition structures */
-  asn1_delete_structure (&definitions);
-  asn1_delete_structure (&asn1_element);
+  asn1_internal_delete_structure (&definitions);
+  asn1_internal_delete_structure (&asn1_element);
 
   if (out != stdout)
     fclose (out);
diff --git a/tests/Test_encoding.c b/tests/Test_encoding.c
index 7d3266c..fdcb08d 100644
--- a/tests/Test_encoding.c
+++ b/tests/Test_encoding.c
@@ -26,7 +26,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include "libtasn1.h"
+#include "libtasn1-internal.h"
 
 
 unsigned char data[256];
@@ -56,79 +56,79 @@ main (int argc, char *argv[])
     }
 
   /* Check version */
-  if (asn1_check_version ("0.3.3") == NULL)
+  if (asn1_internal_check_version ("0.3.3") == NULL)
     printf ("\nLibrary version check ERROR:\n actual version: %s\n\n",
-	    asn1_check_version (NULL));
+	    asn1_internal_check_version (NULL));
 
-  result = asn1_parser2tree (treefile, &definitions, errorDescription);
+  result = asn1_internal_parser2tree (treefile, &definitions, errorDescription);
 
   if (result != ASN1_SUCCESS)
     {
-      asn1_perror (result);
+      asn1_internal_perror (result);
       printf ("ErrorDescription = %s\n\n", errorDescription);
       exit (1);
     }
 
-  result = asn1_create_element (definitions, "TEST_TREE.Koko", &asn1_element);
+  result = asn1_internal_create_element (definitions, "TEST_TREE.Koko", &asn1_element);
   if (result != ASN1_SUCCESS)
     {
       fprintf (stderr, "asn1_create_element(): ");
-      asn1_perror (result);
+      asn1_internal_perror (result);
       exit (1);
     }
 
-  result = asn1_write_value (asn1_element, "seqint", "NEW", 1);
+  result = asn1_internal_write_value (asn1_element, "seqint", "NEW", 1);
   if (result != ASN1_SUCCESS)
     {
       fprintf (stderr, "asn1_write_value(): seqint ");
-      asn1_perror (result);
+      asn1_internal_perror (result);
       exit (1);
     }
 
-  result = asn1_write_value (asn1_element, "seqint.?LAST", "1234", 0);
+  result = asn1_internal_write_value (asn1_element, "seqint.?LAST", "1234", 0);
   if (result != ASN1_SUCCESS)
     {
       fprintf (stderr, "asn1_write_value(): seqint.?LAST ");
-      asn1_perror (result);
+      asn1_internal_perror (result);
       exit (1);
     }
 
-  result = asn1_write_value (asn1_element, "int", "\x0f\xff\x01", 3);
+  result = asn1_internal_write_value (asn1_element, "int", "\x0f\xff\x01", 3);
   if (result != ASN1_SUCCESS)
     {
       fprintf (stderr, "asn1_write_value(): int ");
-      asn1_perror (result);
+      asn1_internal_perror (result);
       exit (1);
     }
 
-  result = asn1_write_value (asn1_element, "str", "string", 6);
+  result = asn1_internal_write_value (asn1_element, "str", "string", 6);
   if (result != ASN1_SUCCESS)
     {
       fprintf (stderr, "asn1_write_value(): str ");
-      asn1_perror (result);
+      asn1_internal_perror (result);
       exit (1);
     }
 
   /* Clear the definition structures */
-  asn1_delete_structure (&definitions);
+  asn1_internal_delete_structure (&definitions);
 
-  result = asn1_der_coding (asn1_element, "", data, &data_size, NULL);
+  result = asn1_internal_der_coding (asn1_element, "", data, &data_size, NULL);
   if (result != ASN1_SUCCESS)
     {
       fprintf (stderr, "Encoding error.\n");
-      asn1_perror (result);
+      asn1_internal_perror (result);
       exit (1);
     }
 
-  result = asn1_der_decoding (&asn1_element, data, data_size, NULL);
+  result = asn1_internal_der_decoding (&asn1_element, data, data_size, NULL);
   if (result != ASN1_SUCCESS)
     {
       fprintf (stderr, "Decoding error.\n");
-      asn1_perror (result);
+      asn1_internal_perror (result);
       exit (1);
     }
 
-  asn1_delete_structure (&asn1_element);
+  asn1_internal_delete_structure (&asn1_element);
 
   if (verbose)
     printf ("Success\n");
diff --git a/tests/Test_errors.c b/tests/Test_errors.c
index 35771b0..e916294 100644
--- a/tests/Test_errors.c
+++ b/tests/Test_errors.c
@@ -18,7 +18,7 @@
  *
  */
 
-#include "libtasn1.h"
+#include "libtasn1-internal.h"
 
 int
 main (int argc, char *argv[])
@@ -32,9 +32,9 @@ main (int argc, char *argv[])
 
   do
     {
-      errstr = asn1_strerror (ec);
+      errstr = asn1_internal_strerror (ec);
       if (verbose != 0)
-	asn1_perror (ec);
+	asn1_internal_perror (ec);
       ec++;
     }
   while (errstr);
diff --git a/tests/Test_indefinite.c b/tests/Test_indefinite.c
index c1613ef..e69d718 100644
--- a/tests/Test_indefinite.c
+++ b/tests/Test_indefinite.c
@@ -32,7 +32,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include "libtasn1.h"
+#include "libtasn1-internal.h"
 
 
 
@@ -68,14 +68,14 @@ main (int argc, char *argv[])
     }
 
   /* Check version */
-  if (asn1_check_version ("0.2.11") == NULL)
+  if (asn1_internal_check_version ("0.2.11") == NULL)
     printf ("\nLibrary version check ERROR:\n actual version: %s\n\n",
-	    asn1_check_version (NULL));
+	    asn1_internal_check_version (NULL));
 
-  result = asn1_parser2tree (treefile, &definitions, errorDescription);
+  result = asn1_internal_parser2tree (treefile, &definitions, errorDescription);
   if (result != ASN1_SUCCESS)
     {
-      asn1_perror (result);
+      asn1_internal_perror (result);
       printf ("ErrorDescription = %s\n\n", errorDescription);
       exit (1);
     }
@@ -98,25 +98,25 @@ main (int argc, char *argv[])
   fclose (fd);
 
   result =
-    asn1_create_element (definitions, "PKIX1.pkcs-12-PFX", &asn1_element);
+    asn1_internal_create_element (definitions, "PKIX1.pkcs-12-PFX", &asn1_element);
   if (result != ASN1_SUCCESS)
     {
-      asn1_perror (result);
+      asn1_internal_perror (result);
       printf ("Cannot create PKCS12 element\n");
       exit (1);
     }
 
-  result = asn1_der_decoding (&asn1_element, buffer, size, errorDescription);
+  result = asn1_internal_der_decoding (&asn1_element, buffer, size, errorDescription);
   if (result != ASN1_SUCCESS)
     {
-      asn1_perror (result);
+      asn1_internal_perror (result);
       printf ("Cannot decode BER data (size %ld)\n", (long) size);
       exit (1);
     }
 
   /* Clear the definition structures */
-  asn1_delete_structure (&definitions);
-  asn1_delete_structure (&asn1_element);
+  asn1_internal_delete_structure (&definitions);
+  asn1_internal_delete_structure (&asn1_element);
 
   if (out != stdout)
     fclose (out);
diff --git a/tests/Test_overflow.c b/tests/Test_overflow.c
index b276b6d..79b8ac7 100644
--- a/tests/Test_overflow.c
+++ b/tests/Test_overflow.c
@@ -25,7 +25,7 @@
 #include <stdlib.h>
 #include <limits.h>
 
-#include "libtasn1.h"
+#include "libtasn1-internal.h"
 
 int
 main (int argc, char **argv)
@@ -42,16 +42,16 @@ main (int argc, char **argv)
     long l;
     int len;
 
-    l = asn1_get_length_der (der, sizeof der, &len);
+    l = asn1_internal_get_length_der (der, sizeof der, &len);
 
     if (l == -2L)
       {
 	if (verbose)
-	  puts ("OK: asn1_get_length_der bignum");
+	  puts ("OK: asn1_internal_get_length_der bignum");
       }
     else
       {
-	printf ("ERROR: asn1_get_length_der bignum (l %ld len %d)\n", l, len);
+	printf ("ERROR: asn1_internal_get_length_der bignum (l %ld len %d)\n", l, len);
 	return 1;
       }
   }
@@ -66,18 +66,18 @@ main (int argc, char **argv)
       long l;
       int len;
 
-      asn1_length_der (num, der, &der_len);
+      asn1_internal_length_der (num, der, &der_len);
 
-      l = asn1_get_length_der (der, der_len, &len);
+      l = asn1_internal_get_length_der (der, der_len, &len);
 
       if (l == -2L)
 	{
 	  if (verbose)
-	    puts ("OK: asn1_get_length_der intnum");
+	    puts ("OK: asn1_internal_get_length_der intnum");
 	}
       else
 	{
-	  printf ("ERROR: asn1_get_length_der intnum (l %ld len %d)\n", l,
+	  printf ("ERROR: asn1_internal_get_length_der intnum (l %ld len %d)\n", l,
 		  len);
 	  return 1;
 	}
@@ -92,19 +92,19 @@ main (int argc, char **argv)
     long l;
     int len;
 
-    asn1_length_der (num, der, &der_len);
+    asn1_internal_length_der (num, der, &der_len);
 
     der_len = sizeof (der);
-    l = asn1_get_length_der (der, der_len, &len);
+    l = asn1_internal_get_length_der (der, der_len, &len);
 
     if (l == -4L)
       {
 	if (verbose)
-	  puts ("OK: asn1_get_length_der overflow-small");
+	  puts ("OK: asn1_internal_get_length_der overflow-small");
       }
     else
       {
-	printf ("ERROR: asn1_get_length_der overflow-small (l %ld len %d)\n",
+	printf ("ERROR: asn1_internal_get_length_der overflow-small (l %ld len %d)\n",
 		l, len);
 	return 1;
       }
@@ -119,19 +119,19 @@ main (int argc, char **argv)
     long l;
     int len;
 
-    asn1_length_der (num, der, &der_len);
+    asn1_internal_length_der (num, der, &der_len);
 
     der_len = sizeof (der);
-    l = asn1_get_length_der (der, der_len, &len);
+    l = asn1_internal_get_length_der (der, der_len, &len);
 
     if (l == -4L)
       {
 	if (verbose)
-	  puts ("OK: asn1_get_length_der overflow-large1");
+	  puts ("OK: asn1_internal_get_length_der overflow-large1");
       }
     else
       {
-	printf ("ERROR: asn1_get_length_der overflow-large1 (l %ld len %d)\n",
+	printf ("ERROR: asn1_internal_get_length_der overflow-large1 (l %ld len %d)\n",
 		l, len);
 	return 1;
       }
@@ -146,19 +146,19 @@ main (int argc, char **argv)
     long l;
     int len;
 
-    asn1_length_der (num, der, &der_len);
+    asn1_internal_length_der (num, der, &der_len);
 
     der_len = sizeof (der);
-    l = asn1_get_length_der (der, der_len, &len);
+    l = asn1_internal_get_length_der (der, der_len, &len);
 
     if (l == -2L)
       {
 	if (verbose)
-	  puts ("OK: asn1_get_length_der overflow-large2");
+	  puts ("OK: asn1_internal_get_length_der overflow-large2");
       }
     else
       {
-	printf ("ERROR: asn1_get_length_der overflow-large2 (l %ld len %d)\n",
+	printf ("ERROR: asn1_internal_get_length_der overflow-large2 (l %ld len %d)\n",
 		l, len);
 	return 1;
       }
diff --git a/tests/Test_parser.c b/tests/Test_parser.c
index 7a51843..ec19144 100644
--- a/tests/Test_parser.c
+++ b/tests/Test_parser.c
@@ -28,7 +28,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include "libtasn1.h"
+#include "libtasn1-internal.h"
 
 typedef struct
 {
@@ -177,12 +177,12 @@ main (int argc, char *argv[])
       printf ("ASN1PARSER: %s\n", fileCorrectName);
     }
 
-  result = asn1_parser2tree (fileCorrectName, &definitions, errorDescription);
+  result = asn1_internal_parser2tree (fileCorrectName, &definitions, errorDescription);
 
   if (result != ASN1_SUCCESS)
     {
       printf ("File '%s' not correct\n", fileCorrectName);
-      asn1_perror (result);
+      asn1_internal_perror (result);
       printf ("ErrorDescription = %s\n\n", errorDescription);
       exit (1);
     }
@@ -191,7 +191,7 @@ main (int argc, char *argv[])
   /* asn1_visit_tree(stdout,definitions,"TEST_PARSER",ASN1_PRINT_ALL); */
 
   /* Clear the definitions structures */
-  asn1_delete_structure (&definitions);
+  asn1_internal_delete_structure (&definitions);
 
 
   test = test_array;
@@ -203,8 +203,8 @@ main (int argc, char *argv[])
       createFile (test->lineNumber, test->line);
 
       result =
-	asn1_parser2tree (fileErroredName, &definitions, errorDescription);
-      asn1_delete_structure (&definitions);
+	asn1_internal_parser2tree (fileErroredName, &definitions, errorDescription);
+      asn1_internal_delete_structure (&definitions);
 
       if ((result != test->errorNumber) ||
 	  (strcmp (errorDescription, test->errorDescription)))
@@ -213,8 +213,8 @@ main (int argc, char *argv[])
 	  printf ("ERROR N. %d:\n", errorCounter);
 	  printf ("  Line %d - %s\n", test->lineNumber, test->line);
 	  printf ("  Error expected: %s - %s\n",
-		  asn1_strerror (test->errorNumber), test->errorDescription);
-	  printf ("  Error detected: %s - %s\n\n", asn1_strerror (result),
+		  asn1_internal_strerror (test->errorNumber), test->errorDescription);
+	  printf ("  Error detected: %s - %s\n\n", asn1_internal_strerror (result),
 		  errorDescription);
 	  exit (1);
 	}
diff --git a/tests/Test_simple.c b/tests/Test_simple.c
index a846958..72c928c 100644
--- a/tests/Test_simple.c
+++ b/tests/Test_simple.c
@@ -24,7 +24,7 @@
 #include <string.h>
 #include <stdlib.h>
 
-#include "libtasn1.h"
+#include "libtasn1-internal.h"
 
 struct tv
 {
@@ -89,11 +89,11 @@ main (int argc, char *argv[])
 
   /* Dummy test */
 
-  asn1_bit_der (NULL, 0, der, &der_len);
-  result = asn1_get_bit_der (der, 0, &ret_len, str, str_size, &bit_len);
+  asn1_internal_bit_der (NULL, 0, der, &der_len);
+  result = asn1_internal_get_bit_der (der, 0, &ret_len, str, str_size, &bit_len);
   if (result != ASN1_GENERIC_ERROR)
     {
-      fprintf (stderr, "asn1_get_bit_der zero\n");
+      fprintf (stderr, "asn1_internal_get_bit_der zero\n");
       return 1;
     }
 
@@ -103,7 +103,7 @@ main (int argc, char *argv[])
     {
       /* Encode */
 
-      asn1_bit_der ((const unsigned char *) tv[i].bitstr, tv[i].bitlen,
+      asn1_internal_bit_der ((const unsigned char *) tv[i].bitstr, tv[i].bitlen,
 		    der, &der_len);
 
 #if 0
@@ -117,18 +117,18 @@ main (int argc, char *argv[])
 
       if (der_len != tv[i].derlen || memcmp (der, tv[i].der, der_len) != 0)
 	{
-	  fprintf (stderr, "asn1_bit_der iter %lu\n", (unsigned long) i);
+	  fprintf (stderr, "asn1_internal_bit_der iter %lu\n", (unsigned long) i);
 	  return 1;
 	}
 
       /* Decode it */
 
-      result = asn1_get_bit_der (der, der_len, &ret_len, str,
+      result = asn1_internal_get_bit_der (der, der_len, &ret_len, str,
 				 str_size, &bit_len);
       if (result != ASN1_SUCCESS || ret_len != tv[i].derlen
 	  || bit_len != tv[i].bitlen)
 	{
-	  fprintf (stderr, "asn1_get_bit_der iter %lu, err: %d\n", (unsigned long) i, result);
+	  fprintf (stderr, "asn1_internal_get_bit_der iter %lu, err: %d\n", (unsigned long) i, result);
 	  return 1;
 	}
     }
@@ -146,19 +146,19 @@ main (int argc, char *argv[])
   memcpy (der, "\x04\x06\x6e\x5d\xc0", 5);
   der_len = 5;
 
-  result = asn1_get_bit_der (der, der_len, &ret_len, str, str_size, &bit_len);
+  result = asn1_internal_get_bit_der (der, der_len, &ret_len, str, str_size, &bit_len);
   if (result != ASN1_SUCCESS || ret_len != 5
       || bit_len != 18 || memcmp (str, "\x6e\x5d\xc0", 3) != 0)
     {
-      fprintf (stderr, "asn1_get_bit_der example\n");
+      fprintf (stderr, "asn1_internal_get_bit_der example\n");
       return 1;
     }
 
   der_len = sizeof (der);
-  asn1_bit_der (str, bit_len, der, &der_len);
+  asn1_internal_bit_der (str, bit_len, der, &der_len);
   if (der_len != 5 || memcmp (der, "\x04\x06\x6e\x5d\xc0", 5) != 0)
     {
-      fprintf (stderr, "asn1_bit_der example roundtrip\n");
+      fprintf (stderr, "asn1_internal_bit_der example roundtrip\n");
       return 1;
     }
 
@@ -167,19 +167,19 @@ main (int argc, char *argv[])
   memcpy (der, "\x04\x06\x6e\x5d\xe0", 5);
   der_len = 5;
 
-  result = asn1_get_bit_der (der, der_len, &ret_len, str, str_size, &bit_len);
+  result = asn1_internal_get_bit_der (der, der_len, &ret_len, str, str_size, &bit_len);
   if (result != ASN1_SUCCESS || ret_len != 5
       || bit_len != 18 || memcmp (str, "\x6e\x5d\xe0", 3) != 0)
     {
-      fprintf (stderr, "asn1_get_bit_der example padded\n");
+      fprintf (stderr, "asn1_internal_get_bit_der example padded\n");
       return 1;
     }
 
   der_len = sizeof (der);
-  asn1_bit_der (str, bit_len, der, &der_len);
+  asn1_internal_bit_der (str, bit_len, der, &der_len);
   if (der_len != 5 || memcmp (der, "\x04\x06\x6e\x5d\xc0", 5) != 0)
     {
-      fprintf (stderr, "asn1_bit_der example roundtrip\n");
+      fprintf (stderr, "asn1_internal_bit_der example roundtrip\n");
       return 1;
     }
 
@@ -188,20 +188,20 @@ main (int argc, char *argv[])
   memcpy (der, "\x81\x04\x06\x6e\x5d\xc0", 6);
   der_len = 6;
 
-  result = asn1_get_bit_der (der, der_len, &ret_len, str, str_size, &bit_len);
+  result = asn1_internal_get_bit_der (der, der_len, &ret_len, str, str_size, &bit_len);
 
   if (result != ASN1_SUCCESS || ret_len != 6
       || bit_len != 18 || memcmp (str, "\x6e\x5d\xc0", 3) != 0)
     {
-      fprintf (stderr, "asn1_get_bit_der example long form\n");
+      fprintf (stderr, "asn1_internal_get_bit_der example long form\n");
       return 1;
     }
 
   der_len = sizeof (der);
-  asn1_bit_der (str, bit_len, der, &der_len);
+  asn1_internal_bit_der (str, bit_len, der, &der_len);
   if (der_len != 5 || memcmp (der, "\x04\x06\x6e\x5d\xc0", 5) != 0)
     {
-      fprintf (stderr, "asn1_bit_der example roundtrip\n");
+      fprintf (stderr, "asn1_internal_bit_der example roundtrip\n");
       return 1;
     }
 
diff --git a/tests/Test_strings.c b/tests/Test_strings.c
index f3d3dba..f31b48a 100644
--- a/tests/Test_strings.c
+++ b/tests/Test_strings.c
@@ -24,7 +24,7 @@
 #include <string.h>
 #include <stdlib.h>
 
-#include "libtasn1.h"
+#include "libtasn1-internal.h"
 
 struct tv
 {
@@ -69,12 +69,12 @@ main (int argc, char *argv[])
     {
       /* Encode */
       tl_len = sizeof (tl);
-      ret = asn1_encode_simple_der (tv[i].etype, tv[i].str, tv[i].str_len,
+      ret = asn1_internal_encode_simple_der (tv[i].etype, tv[i].str, tv[i].str_len,
 				    tl, &tl_len);
       if (ret != ASN1_SUCCESS)
 	{
 	  fprintf (stderr, "Encoding error in %u: %s\n", i,
-		   asn1_strerror (ret));
+		   asn1_internal_strerror (ret));
 	  return 1;
 	}
       der_len = tl_len + tv[i].str_len;
@@ -89,12 +89,12 @@ main (int argc, char *argv[])
 
       /* decoding */
       ret =
-	asn1_decode_simple_der (tv[i].etype, tv[i].der, tv[i].der_len, &str,
+	asn1_internal_decode_simple_der (tv[i].etype, tv[i].der, tv[i].der_len, &str,
 				&str_len);
       if (ret != ASN1_SUCCESS)
 	{
 	  fprintf (stderr, "Decoding error in %u: %s\n", i,
-		   asn1_strerror (ret));
+		   asn1_internal_strerror (ret));
 	  return 1;
 	}
 
diff --git a/tests/Test_tree.c b/tests/Test_tree.c
index 0b6a7df..b991ef4 100644
--- a/tests/Test_tree.c
+++ b/tests/Test_tree.c
@@ -35,7 +35,7 @@
 #include <stdlib.h>
 
 #define ASN1_INTERNAL_BUILD
-#include "libtasn1.h"
+#include "libtasn1-internal.h"
 
 #include "Test_tree_asn1_tab.c"
 
@@ -489,19 +489,19 @@ main (int argc, char *argv[])
     }
 
   /* Check version */
-  if (asn1_check_version ("0.2.11") == NULL)
+  if (asn1_internal_check_version ("0.2.11") == NULL)
     printf ("\nLibrary version check ERROR:\n actual version: %s\n\n",
-	    asn1_check_version (NULL));
+	    asn1_internal_check_version (NULL));
 
   if (1)
-    result = asn1_parser2tree (treefile, &definitions, errorDescription);
+    result = asn1_internal_parser2tree (treefile, &definitions, errorDescription);
   else
     result =
-      asn1_array2tree (Test_tree_asn1_tab, &definitions, errorDescription);
+      asn1_internal_array2tree (Test_tree_asn1_tab, &definitions, errorDescription);
 
   if (result != ASN1_SUCCESS)
     {
-      asn1_perror (result);
+      asn1_internal_perror (result);
       printf ("ErrorDescription = %s\n\n", errorDescription);
       exit (1);
     }
@@ -519,7 +519,7 @@ main (int argc, char *argv[])
 
   if (0)
     {
-      asn1_print_structure (out, definitions, "TEST_TREE", ASN1_PRINT_ALL);
+      asn1_internal_print_structure (out, definitions, "TEST_TREE", ASN1_PRINT_ALL);
       fprintf (out, "\n");
     }
 
@@ -533,85 +533,85 @@ main (int argc, char *argv[])
 	{
 	case ACT_CREATE:
 	  result =
-	    asn1_create_element (definitions, test->par1, &asn1_element);
+	    asn1_internal_create_element (definitions, test->par1, &asn1_element);
 	  break;
 	case ACT_DELETE:
-	  result = asn1_delete_structure (&asn1_element);
+	  result = asn1_internal_delete_structure (&asn1_element);
 	  break;
 	case ACT_DELETE2:
-	  result = asn1_delete_structure2 (&asn1_element, ASN1_DELETE_FLAG_ZEROIZE);
+	  result = asn1_internal_delete_structure2 (&asn1_element, ASN1_DELETE_FLAG_ZEROIZE);
 	  break;
 	case ACT_DELETE_ELEMENT:
-	  result = asn1_delete_element (asn1_element, test->par1);
+	  result = asn1_internal_delete_element (asn1_element, test->par1);
 	  break;
 	case ACT_WRITE:
 	  if ((test->par2) && (!strcmp ("DER", test->par2)))
 	    result =
-	      asn1_write_value (asn1_element, test->par1, der, der_len);
+	      asn1_internal_write_value (asn1_element, test->par1, der, der_len);
 	  else
 	    result =
-	      asn1_write_value (asn1_element, test->par1, test->par2,
+	      asn1_internal_write_value (asn1_element, test->par1, test->par2,
 				test->par3);
 	  break;
 	case ACT_READ:
 	case ACT_READ_BIT:
 	  valueLen = test->par3;
 	  result =
-	    asn1_read_value (asn1_element, test->par1, value, &valueLen);
+	    asn1_internal_read_value (asn1_element, test->par1, value, &valueLen);
 	  break;
 	case ACT_READ_LENGTH:
 	  valueLen = 0;
 	  result =
-	    asn1_read_value (asn1_element, test->par1, NULL, &valueLen);
+	    asn1_internal_read_value (asn1_element, test->par1, NULL, &valueLen);
 	  break;
 	case ACT_READ_DEFINITIONS:
 	  valueLen = 1024;
 	  result =
-	    asn1_read_value (definitions, test->par1, value, &valueLen);
+	    asn1_internal_read_value (definitions, test->par1, value, &valueLen);
 	  break;
 	case ACT_READ_TAG_CLASS:
-	  result = asn1_read_tag (asn1_element, test->par1, &tag, &class);
+	  result = asn1_internal_read_tag (asn1_element, test->par1, &tag, &class);
 	  break;
 	case ACT_ENCODING:
 	  der_len = test->par3;
-	  result = asn1_der_coding (asn1_element, test->par1, der, &der_len,
+	  result = asn1_internal_der_coding (asn1_element, test->par1, der, &der_len,
 				    errorDescription);
 	  break;
 	case ACT_ENCODING_LENGTH:
 	  der_len = 0;
-	  result = asn1_der_coding (asn1_element, test->par1, NULL, &der_len,
+	  result = asn1_internal_der_coding (asn1_element, test->par1, NULL, &der_len,
 				    errorDescription);
 	  break;
 	case ACT_DECODING:
-	  result = asn1_der_decoding (&asn1_element, der, der_len,
+	  result = asn1_internal_der_decoding (&asn1_element, der, der_len,
 				      errorDescription);
 	  break;
 	case ACT_DECODING_ELEMENT:
 	  result =
-	    asn1_der_decoding_element (&asn1_element, test->par1, der,
+	    asn1_internal_der_decoding_element (&asn1_element, test->par1, der,
 				       der_len, errorDescription);
 	  break;
 	case ACT_DECODING_START_END:
 	  result =
-	    asn1_der_decoding_startEnd (asn1_element, der, der_len,
+	    asn1_internal_der_decoding_startEnd (asn1_element, der, der_len,
 					test->par1, &start, &end);
 	  break;
 	case ACT_EXPAND_ANY:
-	  result = asn1_expand_any_defined_by (definitions, &asn1_element);
+	  result = asn1_internal_expand_any_defined_by (definitions, &asn1_element);
 	  break;
 	case ACT_EXPAND_OCTET:
 	  result =
-	    asn1_expand_octet_string (definitions, &asn1_element, test->par1,
+	    asn1_internal_expand_octet_string (definitions, &asn1_element, test->par1,
 				      test->par2);
 	  break;
 	case ACT_OID_2_STRUCTURE:
-	  str_p = asn1_find_structure_from_oid (definitions, test->par1);
+	  str_p = asn1_internal_find_structure_from_oid (definitions, test->par1);
 	  break;
 	case ACT_VISIT:
 	  if (verbose)
 	    {
-	      asn1_print_structure (out, asn1_element, test->par1,
-				    test->par3);
+	      asn1_internal_print_structure (out, asn1_element, test->par1,
+					     test->par3);
 	      fprintf (out, "\n");
 	    }
 	  result = ASN1_SUCCESS;
@@ -634,7 +634,7 @@ main (int argc, char *argv[])
 	  break;
 	case ACT_NUMBER_OF_ELEMENTS:
 	  result =
-	    asn1_number_of_elements (asn1_element, test->par1, &valueLen);
+	    asn1_internal_number_of_elements (asn1_element, test->par1, &valueLen);
 	  break;
 	default:
 	  break;
@@ -661,8 +661,8 @@ main (int argc, char *argv[])
 	      printf ("  Action %d - %s - %s - %d\n", test->action,
 		      test->par1, test->par2, test->par3);
 	      printf ("  Error expected: %s\n",
-		      asn1_strerror (test->errorNumber));
-	      printf ("  Error detected: %s\n\n", asn1_strerror (result));
+		      asn1_internal_strerror (test->errorNumber));
+	      printf ("  Error detected: %s\n\n", asn1_internal_strerror (result));
 	      error ();
 	    }
 	  break;
@@ -674,8 +674,8 @@ main (int argc, char *argv[])
 	      printf ("  Action %d - %s - %s - %d\n", test->action,
 		      test->par1, test->par2, test->par3);
 	      printf ("  Error expected: %s\n",
-		      asn1_strerror (test->errorNumber));
-	      printf ("  Error detected: %s\n", asn1_strerror (result));
+		      asn1_internal_strerror (test->errorNumber));
+	      printf ("  Error detected: %s\n", asn1_internal_strerror (result));
 	      printf ("  Error description : %s\n\n", errorDescription);
 	      error ();
 	    }
@@ -688,8 +688,8 @@ main (int argc, char *argv[])
 	      printf ("ERROR in %d:\n", test->line);
 	      printf ("  Action %d - %s\n", test->action, test->par1);
 	      printf ("  Error expected: %s - %d\n",
-		      asn1_strerror (test->errorNumber), test->par3);
-	      printf ("  Error detected: %s - %d\n\n", asn1_strerror (result),
+		      asn1_internal_strerror (test->errorNumber), test->par3);
+	      printf ("  Error detected: %s - %d\n\n", asn1_internal_strerror (result),
 		      valueLen);
 	      error ();
 	    }
@@ -701,8 +701,8 @@ main (int argc, char *argv[])
 	      printf ("ERROR in %d:\n", test->line);
 	      printf ("  Action %d - %s\n", test->action, test->par1);
 	      printf ("  Error expected: %s - %d\n",
-		      asn1_strerror (test->errorNumber), test->par3);
-	      printf ("  Error detected: %s - %d\n\n", asn1_strerror (result),
+		      asn1_internal_strerror (test->errorNumber), test->par3);
+	      printf ("  Error detected: %s - %d\n\n", asn1_internal_strerror (result),
 		      der_len);
 	      error ();
 	    }
@@ -717,7 +717,7 @@ main (int argc, char *argv[])
 	      printf ("ERROR in %d:\n", test->line);
 	      printf ("  Action %d - %s\n", test->action, test->par1);
 	      printf ("  Error expected: %s - %s\n",
-		      asn1_strerror (test->errorNumber), test->par2);
+		      asn1_internal_strerror (test->errorNumber), test->par2);
 	      printf ("  Value detected: %s\n\n", str_p);
 	      error ();
 	    }
@@ -732,10 +732,10 @@ main (int argc, char *argv[])
 	      printf ("  Action %d - %s - %d\n", test->action, test->par1,
 		      test->par3);
 	      printf ("  Error expected: %s - %s - %d\n",
-		      asn1_strerror (test->errorNumber), test->par2,
+		      asn1_internal_strerror (test->errorNumber), test->par2,
 		      test->par3);
 	      printf ("  Error detected: %s - %d - %d\n\n",
-		      asn1_strerror (result), start, end);
+		      asn1_internal_strerror (result), start, end);
 	      error ();
 	    }
 	  break;
@@ -750,10 +750,10 @@ main (int argc, char *argv[])
 	      printf ("  Action %d - %s - %d\n", test->action, test->par1,
 		      test->par3);
 	      printf ("  Error expected: %s - %s - %d\n",
-		      asn1_strerror (test->errorNumber), test->par2,
+		      asn1_internal_strerror (test->errorNumber), test->par2,
 		      test->par3);
 	      printf ("  Error detected: %s - %d - %d\n\n",
-		      asn1_strerror (result), tag, class);
+		      asn1_internal_strerror (result), tag, class);
 	      error ();
 	    }
 
@@ -788,11 +788,11 @@ main (int argc, char *argv[])
 	      printf ("ERROR in %d:\n", test->line);
 	      printf ("  Action %d - %s\n", test->action, test->par1);
 	      printf ("  Error expected: %s - %d - ",
-		      asn1_strerror (test->errorNumber), test->par3);
+		      asn1_internal_strerror (test->errorNumber), test->par3);
 	      for (k = 0; k < test->par3; k++)
 		printf ("%02x", test->par2[k]);
 	      printf ("\n  Error detected: %s - %d - ",
-		      asn1_strerror (result), valueLen);
+		      asn1_internal_strerror (result), valueLen);
 	      for (k = 0; k < valueLen; k++)
 		printf ("%02x", value[k]);
 	      printf ("\n\n");
@@ -816,7 +816,7 @@ main (int argc, char *argv[])
     }
 
   /* Clear the definition structures */
-  asn1_delete_structure (&definitions);
+  asn1_internal_delete_structure (&definitions);
 
 
   if (out != stdout)
diff --git a/tests/Test_tree_asn1_tab.c b/tests/Test_tree_asn1_tab.c
index 7869f85..1960569 100644
--- a/tests/Test_tree_asn1_tab.c
+++ b/tests/Test_tree_asn1_tab.c
@@ -2,7 +2,7 @@
 # include "config.h"
 #endif
 
-#include <libtasn1.h>
+#include <libtasn1-internal.h>
 
 const asn1_static_node Test_tree_asn1_tab[] = {
   { "TEST_TREE", 536875024, NULL },
