First one is :
takes a string from input in the format <integer1><operation><integer2> and prints an integer result based on the operation as follows (example i/o in parentheses):
a: the sum plus six (input: 2a3 output: 11)
b: twice the sum (input: 2b3 output: 10)
c: 100 minus the product (input: 2c3 output: 94)
And also this program needs to be easy to add new operations as the need arises, possibly hundreds of them.
Second :
program that can be used to verify that a message that ran through the program on one computer has not been altered in transit to another computer which uses the same program. I finished code the mode of transit - But I can't figure that a program to guarantee that a message has not changed between its generation and its reception.:crying:
Can anyone help me with these 2 problems?
Thanks.
4 replies to this topic
#1
Posted 11 November 2010 - 06:40 AM
|
|
|
#2
Posted 11 November 2010 - 10:00 AM
App 1:
You could try making it modular. For each operation you perform, have a class that does the operation and dynamically load it.
Java - Dynamic loading of class and jar file | twit88.com
Then, you could add new operations by simply pushing out new jar files to the clients. (in a situation where a project is distributed to other users.)
App2:
Try public key cryptography. Sign the message with the private key and check integrity with the public key.
You could try making it modular. For each operation you perform, have a class that does the operation and dynamically load it.
Java - Dynamic loading of class and jar file | twit88.com
Then, you could add new operations by simply pushing out new jar files to the clients. (in a situation where a project is distributed to other users.)
App2:
Try public key cryptography. Sign the message with the private key and check integrity with the public key.
Edited by Arctic Fire, 11 November 2010 - 10:34 AM.
#3
Posted 11 November 2010 - 10:58 AM
Thanks.
Just got done with first one.
And second one still seems tricky to me...:(
Just got done with first one.
And second one still seems tricky to me...:(
#4
Posted 11 November 2010 - 02:54 PM
The file class in java has a .setReadOnly() method.
... i think the javadoc is wrong there, it says public boolean setReadyOnly(), which i think must be public void setReadOnly(boolean readOnly)
If that is not secure enough for your liking, i gues you'll need to work with the lastmodified() stuff. Offcourse other programs can set it again so you'll need an extra protection for this by..
maybe let the first line of the file be a hash of the lastmodified. The receiving program will hash the lastmodified() of the file with the same algorithm.
If the hash turns out to be the same as the first line then you can consider it did not change.
...Unless whatever program opened the file between the transition also knows the hashing algorithm, which is very unlikely.
... i think the javadoc is wrong there, it says public boolean setReadyOnly(), which i think must be public void setReadOnly(boolean readOnly)
If that is not secure enough for your liking, i gues you'll need to work with the lastmodified() stuff. Offcourse other programs can set it again so you'll need an extra protection for this by..
maybe let the first line of the file be a hash of the lastmodified. The receiving program will hash the lastmodified() of the file with the same algorithm.
If the hash turns out to be the same as the first line then you can consider it did not change.
...Unless whatever program opened the file between the transition also knows the hashing algorithm, which is very unlikely.
#5
Posted 11 November 2010 - 04:45 PM
How about something like this?
Generating a Message Authentication Code (MAC) | Example Depot
EDIT:
This is a better guide IMO.
MAC:
InformIT: Cryptography with Java > Message Authentication Code
Public Key Signature:
InformIT: Cryptography with Java > Digital Signature
Generating a Message Authentication Code (MAC) | Example Depot
EDIT:
This is a better guide IMO.
MAC:
InformIT: Cryptography with Java > Message Authentication Code
Public Key Signature:
InformIT: Cryptography with Java > Digital Signature
Edited by Arctic Fire, 11 November 2010 - 05:49 PM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









