public inbox for mauve-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Raif S. Naffah" <raif@swiftdsl.com.au>
To: mauve-discuss@sourceware.org
Subject: patches to ensure names w/ extra spaces are recognized
Date: Sun, 01 Jan 2006 23:11:00 -0000	[thread overview]
Message-ID: <200601021012.54773.raif@swiftdsl.com.au> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 658 bytes --]

hello there,

pls find attached a patch to existing MessageDigest.getInstance14.java
and a new Engine.getInstance file to ensure that Provider, Service and
Algorithm names should be recognized even when they contain extra space
characters.

the corresponding ChangeLog entry follows:

2006-01-02  Raif S. Naffah  <raif@swiftdsl.com.au>

	* gnu/testlet/java/security/MessageDigest/getInstance14.java (test):
	  Corrected string literal used in harness.checkPoint().
	  Added 2 new testcases to test passing Provider and Algorithm names with
	  extra spaces.
	* gnu/testlet/java/security/Engine/getInstance.java: new file.

-- 
cheers;
rsn

[-- Attachment #1.2: mauve-20060102.patch --]
[-- Type: text/x-diff, Size: 5054 bytes --]

Index: getInstance14.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/security/MessageDigest/getInstance14.java,v
retrieving revision 1.2
diff -u -r1.2 getInstance14.java
--- getInstance14.java	7 Apr 2003 15:42:11 -0000	1.2
+++ getInstance14.java	1 Jan 2006 22:50:50 -0000
@@ -25,6 +25,8 @@
 package gnu.testlet.java.security.MessageDigest;
 import gnu.testlet.Testlet;
 import gnu.testlet.TestHarness;
+
+import java.security.GeneralSecurityException;
 import java.security.MessageDigest;
 import java.security.Provider;
 import java.security.NoSuchAlgorithmException;
@@ -43,7 +45,7 @@

   public void test (TestHarness harness)
   {
-    harness.checkPoint ("KeyPairGenerator");
+    harness.checkPoint ("MessageDigest");

     MessageDigest spi;
     Provider provider = this;
@@ -51,6 +53,19 @@
     String signature;

     spi = null;
+    signature = "getInstance(\"foo\", \"  MessageDigest  \")";
+    try
+      {
+        spi = MessageDigest.getInstance("foo", "  MessageDigest  ");
+        harness.check(spi != null, signature);
+      }
+    catch (GeneralSecurityException x)
+      {
+        harness.fail(signature);
+        harness.debug(x);
+      }
+
+    spi = null;
     signature = "getInstance(\"foo\", provider)";
     try
       {
@@ -64,6 +79,19 @@
       }

     spi = null;
+    signature = "getInstance(\"  foo  \", provider)";
+    try
+      {
+        spi = MessageDigest.getInstance("  foo  ", provider);
+        harness.check(spi != null, signature);
+      }
+    catch (NoSuchAlgorithmException x)
+      {
+        harness.fail(signature);
+        harness.debug(x);
+      }
+
+    spi = null;
     signature = "getInstance(\"FOO\", provider)";
     try
       {
Index: gnu/testlet/java/security/Engine/getInstance.java
===================================================================
RCS file: gnu/testlet/java/security/Engine/getInstance.java
diff -N gnu/testlet/java/security/Engine/getInstance.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/security/Engine/getInstance.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,106 @@
+/* getInstance.java -- Ensure names with extra spaces are recognized
+   Copyright (C) 2006 Free Software Foundation, Inc.
+This file is part of Mauve.
+
+Mauve is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+Mauve 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
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Mauve; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+*/
+
+// Tags: JDK1.4
+// Uses: MauveDigest
+
+package gnu.testlet.java.security.Engine;
+
+import gnu.java.security.Engine;
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.security.Provider;
+import java.security.Security;
+
+public class getInstance extends Provider implements Testlet
+{
+  public getInstance()
+  {
+    super("FakeProvider", 1.0, "");
+
+    put("MessageDigest.foo",
+        "gnu.testlet.java.security.MessageDigest.MauveDigest");
+    put("Alg.Alias.MessageDigest.bar", "foo");
+  }
+
+  public void test (TestHarness harness)
+  {
+    harness.checkPoint ("Engine");
+
+    Provider provider = this;
+    Security.addProvider(provider);
+    String signature;
+
+    signature = "getInstance(\"MessageDigest\", \"foo\", provider)";
+    try
+      {
+        harness.check(
+            Engine.getInstance("MessageDigest", "foo", provider) != null,
+            signature);
+      }
+    catch (Exception x)
+      {
+        harness.fail(signature);
+        harness.debug(x);
+      }
+
+    signature = "getInstance(\"  MessageDigest  \", \"foo\", provider)";
+    try
+      {
+        harness.check(
+            Engine.getInstance("  MessageDigest  ", "foo", provider) != null,
+            signature);
+      }
+    catch (Exception x)
+      {
+        harness.fail(signature);
+        harness.debug(x);
+      }
+
+    signature = "getInstance(\"MessageDigest\", \"  foo  \", provider)";
+    try
+      {
+        harness.check(
+            Engine.getInstance("MessageDigest", "  foo  ", provider) != null,
+            signature);
+      }
+    catch (Exception x)
+      {
+        harness.fail(signature);
+        harness.debug(x);
+      }
+
+    signature = "getInstance(\"  MessageDigest  \", \"  foo  \", provider)";
+    try
+      {
+        harness.check(
+            Engine.getInstance("  MessageDigest  ", "  foo  ", provider) != null,
+            signature);
+      }
+    catch (Exception x)
+      {
+        harness.fail(signature);
+        harness.debug(x);
+      }
+  }
+}
+

[-- Attachment #2: Type: application/pgp-signature, Size: 216 bytes --]

             reply	other threads:[~2006-01-01 23:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-01 23:11 Raif S. Naffah [this message]
2006-01-02 12:29 ` Mark Wielaard
2006-01-02 14:10   ` Raif S. Naffah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200601021012.54773.raif@swiftdsl.com.au \
    --to=raif@swiftdsl.com.au \
    --cc=mauve-discuss@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).