  
  unsigned
 diff --git a/pgp-pgsql.c b/pgp-pgsql.c
-index d4eec03..c251d3f 100644
+index d4eec03..fe4d20b 100644
 --- a/pgp-pgsql.c
 +++ b/pgp-pgsql.c
 @@ -31,8 +31,10 @@

 	n = b64_encode(src, len, pos);
 	pos += n;
 
@@ -370,10 +387,115 @@ out:
 	return res;
 }
 

+	int			data_len,
+				res;
+	char	   *buf;
+	text	   *key,
+			   *utf8key;
+	int			buflen;
+
+	data = PG_GETARG_BYTEA_P(0);
+	data_len = VARSIZE(data) - VARHDRSZ;
+
+	key = PG_GETARG_TEXT_P(1);
+	utf8key = convert_to_utf8(key);
+	res = pgp_armor_header((uint8 *) VARDATA(data), data_len,
+							VARDATA(utf8key), VARSIZE(utf8key) - VARHDRSZ,
+							(uint8 **) &buf, &buflen);
+	if (res < 0)
+		ereport(ERROR,
