|
http://www.mediafire.com/download.php?yygnyhmd1dg
1. Download rar from above.
2. Open it using Eclipse (JDK6U16)
3. When you provide your account make sure its in the format email@gmail.com
All done.
To setup a personal smtp read this guide:
http://www.ehow.com/how_4489548_set-up-smtp-server-windows.html
Good Luck
|
|
|
|
|
hello sir
the link you provide
http://www.mediafire.com/download.php?yygnyhmd1dg
is not working, the rar file is not available..
please look at it
also tell me that, the code you provided me is just sufficient to send message
or i need to configure a smtp server also..
because i am just running your code
please reply soon...
|
|
|
|
|
|
well Member 4277480
i am trying your code but it still not sending them.
Tell me whether i have to configure some smtp settings
to the gmail account which i am using here.
also if possible please send some important screenshot
like when configuring tomcat server.
also tell me what is this program actually doing, is this sending the mails to any client by using my email address in FROM: option.
do i need to configure any port
Please help me this last time...
I am very close to successfully running it..
Please reply with screenshots
|
|
|
|
|
|
hi
how to convert java swings application to java applet
please guide me
import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.text.DateFormatSymbols;
import java.util.Calendar;
import java.util.Locale;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import com.standbysoft.datepicker.JDatePicker;
public class GeneralDemo extends JPanel {
private JDatePicker datePicker;
public GeneralDemo() {
datePicker = new JDatePicker();
setLayout(new GridBagLayout());
add(datePicker, new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0));
}
private static void createAndShowGUI() {
JFrame frame = new JFrame("GeneralDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GeneralDemo newContentPane = new GeneralDemo();
newContentPane.setOpaque(true); //content panes must be opaque
frame.setContentPane(newContentPane);
//Display the window.
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}
have a nice day
bye
naga
|
|
|
|
|
0. Wrap you code in <PRE> tags, it'll keep it flame-retardent.
1. What have you tried? You have to make an effort for anyone here to help, just asking for code won't be of any use.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Applet Code
import java.applet.*;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import com.standbysoft.component.date.swing.JDatePicker;
public class GeneralDemo_2 extends Applet
{
private JDatePicker datePicker;
public void init()
{
datePicker = new JDatePicker();
setLayout(new GridBagLayout());
add(datePicker, new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0));
}
}
HTML Code
<object
code="GeneralDemo_2.class"
type="application/x-java-applet"
archive="jdatepicker.jar"
height="300" width="450"
>
</object>
Make sure you have the jdatepicker.jar in the same location as your .class and html
Good Luck
|
|
|
|
|
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.http.HttpServlet;
import java.io.*;
public class DateExample extends HttpServlet{
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException {
res.setContentType("text/html");
PrintWriter pw=res.getWriter();
pw.println("<html><head><title>wELCOME TO sERVLET pROGRAMING</title></head>");
pw.println("<body>");
pw.println("Print date and time");
java.util.Date dat=new java.util.Date();
pw.println(dat);
pw.println("</body></html>");
System.out.println("Thnx 4 using this application");
}
}
<servlet>
<servlet-name>hai
<servlet-class>DateExample<
<servlet-mapping>
<servlet-name>hai
<url-pattern>/ServletSample
at the time of deployment iam getting error like this, tell me how to resolve this one.
The requested resource (/ServletSamples/DateExample) is not available.
|
|
|
|
|
A 404 error indicates a WEB/HTML issue rather than a programming bug.
Take a look at your web servers logs. 404 indicates it couldn't find the resource (URI). Is your web.xml properly configured for the servlet?
|
|
|
|
|
Make sure this is in your web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>Test_1.1</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<description></description>
<display-name>DateExample</display-name>
<servlet-name>DateExample</servlet-name>
<servlet-class>DateExample</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DateExample</servlet-name>
<url-pattern>/DateExample</url-pattern>
</servlet-mapping>
</web-app>
Your code works fine
Good luck
|
|
|
|
|
Hi All,
I am very new to this forum. And I have very little knowledge in java. I want to create one key logger application. Please suggest me which language is best whether java or c++. And I dont where to start and how to start. Please people you have any ideas share with me.
|
|
|
|
|
Refering to sun.com[^] JAVA is running 4.5 billion PC's worldwide - why use anything else for a keylogger-virus??
You should start with a concept. A concept does make it easier. I'm pretty sure about that!
greets
Torsten
___________________________________________________________________
I never finish anyth...
|
|
|
|
|
It's really like comparing apples and oranges but anyone will tell you to do it in C++. The advantages of C++ outweigh Java any day of the week; java is intepreted and slow. C++ is native and fast.
Yeah, the only reason I'm helping you us because of the sheer stupidity of your question, in fact it is indeed so stupid, I have absolutely no confidence in your ability to learn java, nevertheless C++.
Good luck at failing.
|
|
|
|
|
It is possible to do it in both but it all comes down to your preference.
Since you posted in Java forum you can use this http://www.steelbrothers.ch/jusb/ Learn it by yourself (no support on this one due to the nature of your application)
Just in case you want to verify input and not log the keys. This is limited to your application.
Snippet
addKeyListener(new KeyAdapter()
{
public void keyTyped(KeyEvent e)
{
}
});
|
|
|
|
|
Hi everyone,
I planned to do a project in Digital Signature.
I just know how to Digitally Sign a Static document.
Now, I need to know, how to sign a document that has a dynamic content.
Can anyone help me to know, how to sign a dynamic content document!
I jus need the steps for how to sign a dynamic document.
Regards,
Vivek
|
|
|
|
|
I need to implement the solution for the dynamic content digital signature as in the paper below!
Just for reference.... http://www.isg.rhul.ac.uk/cjm/dcaods.pdf
|
|
|
|
|
so you have your reference doc, what have you tried?
If this is an accademic project [aka homework] the security of the signature is not too important, it is just the concept.
If this is commercial, then go out and buy a solution - it will be secure and properly tested.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Interesting project, so I believe the main issue is how to implement the aware application that replace the dynamic content from the document, the rest can be achieved easily including the security side notes.
Any one willing to suggest how to do the separation?
modified on Friday, September 4, 2009 10:46 PM
|
|
|
|
|
Ok since my last post I was thinking about how to implement (Just to learn more thats all) the digital awareness but came to a conclusion that for every application we would require to define its own awareness method which I find not practical. Luckily I remembered what we took in email security especially S/MIME the concept of envelop, therefore I thought why not do the same with this problem.
The solution is to convert the given file into a byte array text file and then digitally sign it.
The code I used is as follows (I was lazy to do the output for the data,key,sig) but its easy to do.
import java.io.FileInputStream;
import java.io.InputStream;
import java.security.InvalidKeyException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.Signature;
import java.security.SignatureException;
import java.security.interfaces.DSAPrivateKey;
import java.security.interfaces.DSAPublicKey;
public class SigningDocument
{
public static void main(String[] args) throws Exception
{
InputStream in = new FileInputStream("dcaods.pdf");
int bytesRead=0;
int bytesToRead=1024;
byte[] input = new byte[bytesToRead];
while (bytesRead < bytesToRead)
{
int result = in.read(input, bytesRead, bytesToRead - bytesRead);
if (result == -1) break;
bytesRead += result;
}
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DSA");
keyGen.initialize(1024);
KeyPair keypair = keyGen.genKeyPair();
DSAPrivateKey privateKey = (DSAPrivateKey)keypair.getPrivate();
DSAPublicKey publicKey = (DSAPublicKey)keypair.getPublic();
byte[] signature= createSignature(privateKey,input);
boolean v = verifySignature(publicKey,input,signature);
System.out.print(v);
}
public static byte[] createSignature(PrivateKey key, byte[] buffer)
{
try
{
Signature sig = Signature.getInstance(key.getAlgorithm());
sig.initSign(key);
sig.update(buffer, 0, buffer.length);
return sig.sign();
}
catch (SignatureException e) {}
catch (InvalidKeyException e) {}
catch (NoSuchAlgorithmException e) {}
return null;
}
public static boolean verifySignature(PublicKey key, byte[] buffer, byte[] signature)
{
try
{
Signature sig = Signature.getInstance(key.getAlgorithm());
sig.initVerify(key);
sig.update(buffer, 0, buffer.length);
return sig.verify(signature);
}
catch (SignatureException e) {}
catch (InvalidKeyException e) {}
catch (NoSuchAlgorithmException e) {}
return false;
}
}
What do you think guys?
|
|
|
|
|
@Nagy Vilmos
I am doing this for my learning purpose only and not commercial.
@Member 4277480,
I can understand that you are converting a given file into a text file and digitally signing it.
But, again if the file is renamed the content will become dynamic. To get the true requirement
just have a look at http://www.unirc.it/firma/en/Buccafurri_ISSA_1008.pdf[^]
So, we need to remove the dynamic contents present in it or do some manipulations.
The thing is i cannot figure out how to remove the dynamic content or how to do some manipulations to make the content static.
Thanks in advance!!!
|
|
|
|
|
1. For file name I included it with the digital signature.
2. I zipped my outputs.
3. Created a checksum.
Does this do it? About your concern of dynamic and static the only way I could think of is that each program should have a built in converter to satisfy the condition that was mentioned in your first pdf.
import java.io.*;
import java.math.*;
import java.security.*;
import java.security.interfaces.*;
import java.security.spec.*;
import java.util.*;
import java.util.zip.*;
import javax.swing.*;
public class SigningDocument_2
{
public static void main(String[] args) throws Exception
{
JFileChooser chooser = new JFileChooser();
JFrame frame = new JFrame();
chooser.showOpenDialog(frame);
File file = chooser.getSelectedFile();
frame.dispose();
String FileName = file.getPath();
InputStream in = new FileInputStream(FileName);
int bytesRead=0;
int bytesToRead=(int) new File(FileName).length();
byte[] input = new byte[bytesToRead];
while (bytesRead < bytesToRead)
{
int result = in.read(input, bytesRead, bytesToRead - bytesRead);
if (result == -1) break;
bytesRead += result;
}
byte [] FileNameToByte = FileName.getBytes();
byte [] DataToSign = new byte[input.length +FileNameToByte.length];
for (int i = 0; i < input.length; i++)
{
DataToSign[i] = input[i];
}
int k =0;
for (int i = input.length; i < DataToSign.length; i++)
{
DataToSign[i] = FileNameToByte[k];
k++;
}
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DSA");
keyGen.initialize(1024);
KeyPair keypair = keyGen.genKeyPair();
DSAPrivateKey privateKey = (DSAPrivateKey)keypair.getPrivate();
DSAPublicKey publicKey = (DSAPublicKey)keypair.getPublic();
DSAParams dsaParams = privateKey.getParams();
BigInteger p = dsaParams.getP();
BigInteger q = dsaParams.getQ();
BigInteger g = dsaParams.getG();
BigInteger y = publicKey.getY();
byte[] signature= createSignature(privateKey,DataToSign);
File output = new File("Bytes.txt");
PrintWriter out = new PrintWriter(output);
for (int i =0; i < input.length; i++)
{
out.println(input[i]);
}
out.println(FileName);
out.close();
File output2 = new File("Key.txt");
PrintWriter out2 = new PrintWriter(output2);
out2.println("DSA");
out2.println(p);
out2.println(q);
out2.println(g);
out2.println(y);
out2.close();
File output3 = new File("Signature.txt");
PrintWriter out3 = new PrintWriter(output3);
for (int i =0; i < signature.length; i++)
{
out3.println(signature[i]);
}
out3.close();
Zip("Bytes.txt","Key.txt","Signature.txt");
unZip("Result.zip","checksum.txt");
}
public static byte[] createSignature(PrivateKey key, byte[] buffer)
{
try
{
Signature sig = Signature.getInstance(key.getAlgorithm());
sig.initSign(key);
sig.update(buffer, 0, buffer.length);
return sig.sign();
}
catch (SignatureException e) {}
catch (InvalidKeyException e) {}
catch (NoSuchAlgorithmException e) {}
return null;
}
public static void Zip(String Bytes,String Key,String Signature)
{
String[] filenames = new String[]{Bytes,Key,Signature};
byte[] buf = new byte[1024];
try
{
String outFilename = "Result.zip";
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(outFilename));
for (int i=0; i < filenames.length; i++)
{
FileInputStream in = new FileInputStream(filenames[i]);
out.putNextEntry(new ZipEntry(filenames[i]));
int len;
while ((len = in.read(buf)) > 0)
{
out.write(buf, 0, len);
}
out.closeEntry();
in.close();
}
out.close();
CheckedInputStream cis = new CheckedInputStream(
new FileInputStream(outFilename), new Adler32());
byte[] tempBuf = new byte[1024];
while (cis.read(tempBuf) >= 0) {}
long checksum = cis.getChecksum().getValue();
PrintWriter checksumout = new PrintWriter(new File("checksum.txt"));
checksumout.write(checksum+"");
checksumout.close();
}
catch (IOException e) {}
}
public static void unZip(String zip,String checksumfile) throws NoSuchAlgorithmException, InvalidKeySpecException
{
try
{
ZipFile zf = new ZipFile(zip);
CheckedInputStream cis = new CheckedInputStream(
new FileInputStream(zip), new Adler32());
byte[] tempBuf = new byte[1024];
while (cis.read(tempBuf) >= 0) {}
long checksum = cis.getChecksum().getValue();
Scanner scan = new Scanner(new File(checksumfile));
long verifychecksum = scan.nextLong();
if (verifychecksum == checksum)
{
Enumeration<?> e = zf.entries();
while (e.hasMoreElements())
{
ZipEntry ze = (ZipEntry) e.nextElement();
FileOutputStream fout = new FileOutputStream(ze.getName());
InputStream in = zf.getInputStream(ze);
for (int c = in.read(); c != -1; c = in.read())
{
fout.write(c);
}
in.close();
fout.close();
}
ArrayList<String> Bytes = new ArrayList<String>();
Scanner scanBytes = new Scanner(new File("Bytes.txt"));
while(scanBytes.hasNext())
Bytes.add(scanBytes.nextLine());
ArrayList<String> Key = new ArrayList<String>();
Scanner scanKey = new Scanner(new File("Key.txt"));
while(scanKey.hasNext())
Key.add(scanKey.nextLine());
String algorithm = Key.get(0);
BigInteger p = new BigInteger(Key.get(1));
BigInteger q = new BigInteger(Key.get(2));
BigInteger g = new BigInteger(Key.get(3));
BigInteger y = new BigInteger(Key.get(4));
KeyFactory keyFactory = KeyFactory.getInstance(algorithm);
KeySpec publicKeySpec = new DSAPublicKeySpec(y, p, q, g);
PublicKey publicKey = keyFactory.generatePublic(publicKeySpec);
ArrayList<String> Signature = new ArrayList<String>();
Scanner scanSignature = new Scanner(new File("Signature.txt"));
while(scanSignature.hasNext())
Signature.add(scanSignature.nextLine());
byte [] sig = new byte[Signature.size()];
for (int i =0; i < sig.length;i++)
{
sig[i] = new Byte(Signature.get(i));
}
byte [] bytes = new byte[Bytes.size()];
for (int i =0; i < bytes.length-1;i++)
{
bytes[i] = new Byte(Bytes.get(i));
}
String filename = Bytes.get(Bytes.size()-1);
byte [] FileNameToByte = filename.getBytes();
byte [] DataToSign = new byte[bytes.length +FileNameToByte.length-1];
for (int i = 0; i < bytes.length-1; i++)
{
DataToSign[i] = bytes[i];
}
int k =0;
for (int i = bytes.length-1; i < DataToSign.length; i++)
{
DataToSign[i] = FileNameToByte[k];
k++;
}
boolean bool = verifySignature(publicKey,DataToSign,sig);
if(bool)
{
BuildFile(filename,bytes);
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + filename);
}
else
JOptionPane.showMessageDialog(null,"Warning", "Warning Message",JOptionPane.WARNING_MESSAGE);
}
}
catch (IOException e) {}
}
public static boolean verifySignature(PublicKey key, byte[] buffer, byte[] signature)
{
try
{
Signature sig = Signature.getInstance(key.getAlgorithm());
sig.initVerify(key);
sig.update(buffer, 0, buffer.length);
return sig.verify(signature);
}
catch (SignatureException e) {}
catch (InvalidKeyException e) {}
catch (NoSuchAlgorithmException e) {}
return false;
}
public static void BuildFile(String FileName,byte[] bytes) throws IOException
{
FileOutputStream m = new FileOutputStream(FileName);
m.write(bytes);
m.close();
}
}
modified on Saturday, September 5, 2009 10:15 PM
|
|
|
|
|
public class duplicate {
int temp, true_count;
int ar[] = { 1, 2, 3, 4, 1 };
int count;
public void find() {
for (int i = 0; i < ar.length - 1; i++) {
temp = ar[i];
for (int j = i; j <= ar.length-1 ; j++) {
if (temp == ar[j]) {
count += 1;
}
}
}
}
public static void main(String args[]) {
duplicate dup = new duplicate();
dup.find();
System.out.println("The No of duplicates is :" + dup.count);
}
}
This program is supposed to count the no. of duplicates in thearray and print the same. There is something wrong in the loop. PLs tell me what is wrong with the code.
Thanks
|
|
|
|
|
Have you tried stepping through the code? Even with pencil you will see very quickly:
for (int i = 0; i < ar.length - 1; i++)
Elements of the array are 0..4 and the length is 5. At what value for i is the loop exited?
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Time to do some homework
- Computers (and i assume all being aside humans) do intent to count from 0!
- Make sure you're not finding the number itself. (for example: do not compare the first digit to itself!).
- step out of the loop if you've found what you were looking for.
greets
Torsten
I never finish anyth...
|
|
|
|
|