Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 37723 invoked from network); 3 Dec 2009 21:38:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Dec 2009 21:38:50 -0000 Received: (qmail 95649 invoked by uid 500); 3 Dec 2009 21:38:42 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 95542 invoked by uid 500); 3 Dec 2009 21:38:41 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 95531 invoked by uid 99); 3 Dec 2009 21:38:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Dec 2009 21:38:40 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of juliusdavies@gmail.com designates 209.85.160.51 as permitted sender) Received: from [209.85.160.51] (HELO mail-pw0-f51.google.com) (209.85.160.51) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Dec 2009 21:38:38 +0000 Received: by pwj5 with SMTP id 5so1533116pwj.10 for ; Thu, 03 Dec 2009 13:38:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=jWvuc6KK18MdNEowTLF28PNgefAjdcespvQf87idE1M=; b=ThL8CGqwpOfQN2FQX7ROwa76QPKfPprTMJW48QTrvSmhva+kLu3so7ULjIMRp/XOl6 //jy7I2B0C48iWzhF9KPtUgZsGI9+YifcOSAjYbpFBoaXTz9bd12DFrDiZ/LmLgb+/V2 lrndr5g8iY+EUi+g5r0lAiJrYjkiPy2VL1HSQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=dRk6iWRBY4g/7d8jrMbTnwuevwCAvMoME8/9Pf/ITPP/2tSqv5RAMH+zQplgxuccow HypY6gf1R8hmzvQEG8Yf8w7btX6hoh/Cg8dUcr7Vdn5qZGx/wbvte07xijp8YuNrM3db s1O0DI/tudOytJD15/TcI+UaPJyx8C9wCtSdw= MIME-Version: 1.0 Received: by 10.142.56.9 with SMTP id e9mr298653wfa.62.1259876298050; Thu, 03 Dec 2009 13:38:18 -0800 (PST) In-Reply-To: References: Date: Thu, 3 Dec 2009 13:38:18 -0800 Message-ID: <598ad5b50912031338s7d6767e1ked61a5467ce565f6@mail.gmail.com> Subject: Re: Commons Codec: base64 "strict" mode? From: Julius Davies To: Commons Users List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi, Adam, It doesn't currently do that. Also, Base64 seamlessly decodes URL_SAFE and REGULAR encodings, as well as mixes of the two, even though a mix or URL_SAFE and REGULAR would technically be invalid. I'm not a committer, but I could certainly put together a patch for a strict mode. Something like this? 1. If character is not whitespace, and is not valid, throw exception. 2. If character is inappropriate for our current mode (URL_SAFE or REGULAR), throw exception. 3. Note: Personally I think it's too much trouble to detect weird things like =3D=3D=3D (technically only at most =3D=3D should ever exist), = or characters after =3D=3D. What do you think? ps. I'd probably do it as a subclass: Base64Strict extends Base64 yours, Julius On Thu, Dec 3, 2009 at 9:05 AM, Adam Rabung wrote: > Hello, > Currently, Codec skips base64 characters that are outside of the > encode table. =A0I realize this is perfectly to spec, but I wonder if > other users might appreciate a "strict" mode that throws an exception > when one of these illegal characters are encountered. =A0For example, I > would love an exception to be thrown here: > new Base64().decode("!@#$ iHaveIllegalCharsAtBeginningAndEnd %^&")); > > My apologies if I'm missing the point or if this functionality already ex= ists, > Adam > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > For additional commands, e-mail: user-help@commons.apache.org > > --=20 yours, Julius Davies 250-592-2284 (Home) 250-893-4579 (Mobile) http://juliusdavies.ca/logging.html --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org