ws-tsik-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bradley Ward" <bw...@coindata.com>
Subject FW: Bugfix to PrivateKeyTool.java
Date Thu, 20 Oct 2005 15:46:09 GMT
FYI:

 

I am using TortoiseSVN. It has a visual diff utility, but I'm not aware
of any command line diff tool.

 

I just ran a unix diff on it and got this:

 

$ diff PrivateKeyTool.java PrivateKeyTool2.java

123a124

>               e.printStackTrace(System.err);

173c174,184

<         if (!"PKCS8".equals(key.getFormat())){

---

>         boolean exportable = false;

>         String keyFormat = key.getFormat();

>         if ("PKCS8".equals(keyFormat))

>         {

>               exportable = true;

>         } else if ("PKCS#8".equals(keyFormat))

>         {

>               exportable = true;

>         }

> 

>         if (!exportable){

176c187

<                                                +key.getFormat() + "
format)")

;

---

>                                                +keyFormat + "
format)");

$


 

________________________________

From: Granqvist, Hans [mailto:hgranqvist@verisign.com] 
Sent: Thursday, October 20, 2005 11:23 AM
To: Bradley Ward
Subject: RE: Bugfix to PrivateKeyTool.java

 

You need to attach a proper diff. Which svn client are you using?

 

Just to make sure: Did you run the unit tests to make sure nothing
broke?

 

	 

	
________________________________


	From: Bradley Ward [mailto:bward@coindata.com] 
	Sent: Thursday, October 20, 2005 8:12 AM
	To: tsik-dev@ws.apache.org
	Subject: Bugfix to PrivateKeyTool.java

	Hello - I'm a new developer on the TSIK list. I've downloaded
TSIK and will be using it in my application.

	 

	While working with it, I tried to use the PrivateKeyTool program
in the trunk/src/org/apache/tsik/xmlsig/tools package, but it did not
work for me. Investigating further, I found that the key.getFormat()
call was returning "PKCS#8" which the code did not catch - the code only
caught "PKCS8".

	 

	So I changed this little section of code:

	 

	        Key key = ks.getKey(alias, password.toCharArray());

	 

	        if (!"PKCS8".equals(key.getFormat())){

	            throw new IllegalArgumentException("Key is not
exportable in "

	                                               +"PKCS #8 format
(found " 

	                                               +key.getFormat()
+ " format)");

	        }

	 

	To this:

	 

	        Key key = ks.getKey(alias, password.toCharArray());

	 

	        boolean exportable = false;

	        String keyFormat = key.getFormat();

	        if ("PKCS8".equals(keyFormat))

	        {

	            exportable = true;

	        } else if ("PKCS#8".equals(keyFormat))

	        {

	            exportable = true;

	        }

	        

	        if (!exportable){

	            throw new IllegalArgumentException("Key is not
exportable in "

	                                               +"PKCS #8 format
(found " 

	                                               +keyFormat + "
format)");

	        }

	 

	If you would like to incorporate this code change, I have
attached the modified file.

	 

	Thanks,

	
	Brad

	 

	Bradley Ward

	Coin Data, LLC.


Mime
View raw message