From fe7121efe3a5a21f1a4b360c5673dc3409303bc7 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Thu, 1 Apr 2010 09:20:13 -0500 Subject: [PATCH] Method for LiteralData normalization --- lib/openpgp.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/openpgp.php b/lib/openpgp.php index 947728c..9dcd5fd 100644 --- a/lib/openpgp.php +++ b/lib/openpgp.php @@ -981,6 +981,12 @@ class OpenPGP_LiteralDataPacket extends OpenPGP_Packet { $this->timestamp = $opt['timestamp'] ? $opt['timestamp'] : time(); } + function normalize() { + if($opt['format'] == 'u' || $opt['format'] == 't') { // Normalize line endings + $this->data = str_replace("\n", "\r\n", str_replace("\r", "\n", str_replace("\r\n", "\n", $this->data))); + } + } + function read() { $this->size = $this->length - 1 - 4; $this->format = $this->read_byte();