Author: jflesch
Date: 2007-08-15 16:49:02 +0000 (Wed, 15 Aug 2007)
New Revision: 14699
Modified:
trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKBoardAttachment.java
Log:
Fix signature checking : Take into consideration some "invalid chars"
Modified:
trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKBoardAttachment.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKBoardAttachment.java
2007-08-15 13:23:31 UTC (rev 14698)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKBoardAttachment.java
2007-08-15 16:49:02 UTC (rev 14699)
@@ -128,9 +128,24 @@
return null;
}
+
+ public static final char[] INVALID_CHARS = { '/', '\\', '?', '*', '<',
'>',
+ '\"', ':', '|', '#', '&' };
+
+ private void setBoardName(String name) {
+ if (name.startsWith("."))
+ name = name + "_";
+
+ for (int i = 0 ; i < INVALID_CHARS.length ; i++) {
+ name = name.replace(INVALID_CHARS[i], '_');
+ }
+
+ boardName = name;
+ }
+
public void setValue(String property, String value) {
if ("Name".equals(property)) {
- boardName = value;
+ setBoardName(value);
} else if ("pubKey".equals(property)) {
publicKey = value;
} else if ("privKey".equals(property)) {
@@ -244,12 +259,17 @@
public StringBuffer getSignedStr() {
StringBuffer buf = new StringBuffer();
+ Logger.info(this, "Board : "+boardName);
buf.append(boardName.toLowerCase()).append(KSKMessageParser.SIGNATURE_ELEMENTS_SEPARATOR);
- if (publicKey != null)
-
buf.append(publicKey).append(KSKMessageParser.SIGNATURE_ELEMENTS_SEPARATOR);
- if (privateKey != null)
-
buf.append(privateKey).append(KSKMessageParser.SIGNATURE_ELEMENTS_SEPARATOR);
+ if (publicKey != null) {
+ Logger.info(this, "public key for : "+boardName+" :
'"+publicKey+"'");
+
buf.append(publicKey.trim()).append(KSKMessageParser.SIGNATURE_ELEMENTS_SEPARATOR);
+ }
+ if (privateKey != null) {
+ Logger.info(this, "private key for : "+boardName+" :
'"+privateKey+"'");
+
buf.append(privateKey.trim()).append(KSKMessageParser.SIGNATURE_ELEMENTS_SEPARATOR);
+ }
return buf;
}