|
From: <pe...@us...> - 2003-11-21 04:45:46
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/senders
In directory sc8-pr-cvs1:/tmp/cvs-serv10855/src/java/org/neuclear/senders
Modified Files:
LogSender.java Sender.java SmtpSender.java SoapSender.java
Log Message:
EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
Otherwise You will Finaliate.
Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
This should hopefully make everything more stable (and secure).
Index: LogSender.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/senders/LogSender.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** LogSender.java 19 Nov 2003 23:33:59 -0000 1.11
--- LogSender.java 21 Nov 2003 04:45:13 -0000 1.12
***************
*** 22,25 ****
--- 22,31 ----
* $Id$
* $Log$
+ * Revision 1.12 2003/11/21 04:45:13 pelle
+ * EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
+ * Otherwise You will Finaliate.
+ * Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
+ * This should hopefully make everything more stable (and secure).
+ *
* Revision 1.11 2003/11/19 23:33:59 pelle
* Signers now can generatekeys via the generateKey() method.
***************
*** 92,101 ****
* default receiver.
*/
! public class LogSender extends Sender {
! public SignedNamedObject send(String endpoint, SignedNamedObject obj) throws NeuClearException {
try {
! String digest = URLEncoder.encode(Base64.encode(obj.getDigest()), "UTF-8");
! String name = URLEncoder.encode(obj.getName(), "UTF-8");
! URL url = new URL(Utility.denullString(endpoint, LOGGER) + "?nohtml=1&name=" + name + "&digest=" + digest);
url.openStream();
--- 98,107 ----
* default receiver.
*/
! public final class LogSender extends Sender {
! public final SignedNamedObject send(final String endpoint, final SignedNamedObject obj) throws NeuClearException {
try {
! final String digest = URLEncoder.encode(Base64.encode(obj.getDigest()), "UTF-8");
! final String name = URLEncoder.encode(obj.getName(), "UTF-8");
! final URL url = new URL(Utility.denullString(endpoint, LOGGER) + "?nohtml=1&name=" + name + "&digest=" + digest);
url.openStream();
***************
*** 127,143 ****
*/
! public static Timestamp getTimeStamp(String endpoint, byte rdigest[]) throws NeuClearException {
try {
! String digest = Base64.encode(rdigest);
// System.out.println(digest);
! String encdigest = URLEncoder.encode(digest, "UTF-8");
URL url = null;
url = new URL(LOGGER + "?mode=Query&nohtml=1&digest=" + encdigest);
! BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
! String line = reader.readLine();
// System.out.println(line);
! int pos = line.indexOf('\t');
if (pos >= 0) {
! String stamp = line.substring(0, pos);
return TimeTools.parseTimeStamp(stamp);
}
--- 133,149 ----
*/
! public static Timestamp getTimeStamp(final String endpoint, final byte[] rdigest) throws NeuClearException {
try {
! final String digest = Base64.encode(rdigest);
// System.out.println(digest);
! final String encdigest = URLEncoder.encode(digest, "UTF-8");
URL url = null;
url = new URL(LOGGER + "?mode=Query&nohtml=1&digest=" + encdigest);
! final BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
! final String line = reader.readLine();
// System.out.println(line);
! final int pos = line.indexOf('\t');
if (pos >= 0) {
! final String stamp = line.substring(0, pos);
return TimeTools.parseTimeStamp(stamp);
}
***************
*** 151,155 ****
}
! public static Timestamp getTimeStamp(SignedNamedObject obj) throws NeuClearException {
return getTimeStamp(Utility.denullString(obj.getSignatory().getLogger(), LOGGER), obj.getEncoded().getBytes());
--- 157,161 ----
}
! public static Timestamp getTimeStamp(final SignedNamedObject obj) throws NeuClearException {
return getTimeStamp(Utility.denullString(obj.getSignatory().getLogger(), LOGGER), obj.getEncoded().getBytes());
Index: Sender.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/senders/Sender.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Sender.java 19 Nov 2003 23:33:59 -0000 1.11
--- Sender.java 21 Nov 2003 04:45:13 -0000 1.12
***************
*** 8,11 ****
--- 8,17 ----
* $Id$
* $Log$
+ * Revision 1.12 2003/11/21 04:45:13 pelle
+ * EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
+ * Otherwise You will Finaliate.
+ * Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
+ * This should hopefully make everything more stable (and secure).
+ *
* Revision 1.11 2003/11/19 23:33:59 pelle
* Signers now can generatekeys via the generateKey() method.
***************
*** 72,81 ****
public abstract SignedNamedObject send(String endpoint, SignedNamedObject obj) throws NeuClearException, XMLException;
! public static SignedNamedObject quickSend(String endpoint, SignedNamedObject obj) throws NeuClearException {
! int protloc = endpoint.indexOf(":");
if (protloc < 0)
throw new NeuClearException(endpoint + "Is not in URL format");
! String protocol = endpoint.substring(0, protloc);
! Sender sender = getSender(protocol);
if (sender == null)
throw new NeuClearException("Unsupported Send Protocol:" + endpoint.toString());
--- 78,87 ----
public abstract SignedNamedObject send(String endpoint, SignedNamedObject obj) throws NeuClearException, XMLException;
! public static SignedNamedObject quickSend(final String endpoint, final SignedNamedObject obj) throws NeuClearException {
! final int protloc = endpoint.indexOf(":");
if (protloc < 0)
throw new NeuClearException(endpoint + "Is not in URL format");
! final String protocol = endpoint.substring(0, protloc);
! final Sender sender = getSender(protocol);
if (sender == null)
throw new NeuClearException("Unsupported Send Protocol:" + endpoint.toString());
***************
*** 87,91 ****
}
! public static Sender getSender(String protocol) {
if (SENDERS == null) {
SENDERS = new HashMap();
--- 93,97 ----
}
! public static Sender getSender(final String protocol) {
if (SENDERS == null) {
SENDERS = new HashMap();
***************
*** 100,104 ****
private static Map SENDERS;
! public static void main(String args[]) {
/*
try {
--- 106,110 ----
private static Map SENDERS;
! public static void main(final String[] args) {
/*
try {
Index: SmtpSender.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/senders/SmtpSender.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** SmtpSender.java 19 Nov 2003 23:33:59 -0000 1.13
--- SmtpSender.java 21 Nov 2003 04:45:13 -0000 1.14
***************
*** 8,11 ****
--- 8,17 ----
* $Id$
* $Log$
+ * Revision 1.14 2003/11/21 04:45:13 pelle
+ * EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
+ * Otherwise You will Finaliate.
+ * Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
+ * This should hopefully make everything more stable (and secure).
+ *
* Revision 1.13 2003/11/19 23:33:59 pelle
* Signers now can generatekeys via the generateKey() method.
***************
*** 111,117 ****
import java.util.Properties;
! public class SmtpSender extends Sender {
! public SignedNamedObject send(String endpoint, SignedNamedObject obj) throws NeuClearException {
! Properties props = System.getProperties();
if (endpoint.startsWith("mailto:"))
endpoint = endpoint.substring(7);
--- 117,123 ----
import java.util.Properties;
! public final class SmtpSender extends Sender {
! public final SignedNamedObject send(String endpoint, final SignedNamedObject obj) throws NeuClearException {
! final Properties props = System.getProperties();
if (endpoint.startsWith("mailto:"))
endpoint = endpoint.substring(7);
***************
*** 119,127 ****
props.put("mail.smtp.host", "neuclear.org");// TODO Remove this hardcoded mail server
! Session session = Session.getDefaultInstance(props, null);
try {
// -- Create a new message --
! Message msg = new MimeMessage(session);
// -- Set the FROM and TO fields --
--- 125,133 ----
props.put("mail.smtp.host", "neuclear.org");// TODO Remove this hardcoded mail server
! final Session session = Session.getDefaultInstance(props, null);
try {
// -- Create a new message --
! final Message msg = new MimeMessage(session);
// -- Set the FROM and TO fields --
***************
*** 137,146 ****
// -- Set the subject and body text --
msg.setSubject("You have received a New Named Object: " + obj.getName());
! BodyPart body = new MimeBodyPart();
body.setText("This message contains a signed named object. Please see http://neuclear.org for more info.");
! Multipart multi = new MimeMultipart();
multi.addBodyPart(body);
! BodyPart objpart = new MimeBodyPart();
objpart.setText(obj.getEncoded());
objpart.setHeader("Content-type", "application/nsdl");
--- 143,152 ----
// -- Set the subject and body text --
msg.setSubject("You have received a New Named Object: " + obj.getName());
! final BodyPart body = new MimeBodyPart();
body.setText("This message contains a signed named object. Please see http://neuclear.org for more info.");
! final Multipart multi = new MimeMultipart();
multi.addBodyPart(body);
! final BodyPart objpart = new MimeBodyPart();
objpart.setText(obj.getEncoded());
objpart.setHeader("Content-type", "application/nsdl");
Index: SoapSender.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/senders/SoapSender.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** SoapSender.java 19 Nov 2003 23:33:59 -0000 1.12
--- SoapSender.java 21 Nov 2003 04:45:13 -0000 1.13
***************
*** 8,11 ****
--- 8,17 ----
* $Id$
* $Log$
+ * Revision 1.13 2003/11/21 04:45:13 pelle
+ * EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
+ * Otherwise You will Finaliate.
+ * Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
+ * This should hopefully make everything more stable (and secure).
+ *
* Revision 1.12 2003/11/19 23:33:59 pelle
* Signers now can generatekeys via the generateKey() method.
***************
*** 100,105 ****
! public class SoapSender extends Sender {
! public SignedNamedObject send(String endpoint, SignedNamedObject obj) throws NeuClearException, XMLException {
return VerifyingReader.getInstance().read(SOAPTools.soapRequest(endpoint, obj.getEncoded(), "/receive"));
--- 106,111 ----
! public final class SoapSender extends Sender {
! public final SignedNamedObject send(final String endpoint, final SignedNamedObject obj) throws NeuClearException, XMLException {
return VerifyingReader.getInstance().read(SOAPTools.soapRequest(endpoint, obj.getEncoded(), "/receive"));
|