How can  I encrypt  files with java ?

I don't want others to see the content of my file.so,i try to encrypt the file.
but i don't know how to do .i think there may be two ways to do that .one is coding the file with some encrpytion tachniques .Another is try to add a locker to the file ,when someone try to read it ,the trigger is touched off.This trigger need you to input the password.
These are my granted think .but i don't how to do.if you know,can you please to share with me? Thank you!

The JCE is a cryptogrpahic framework for Java. There are numerous tutorials available on the web and a guide is avaiable at http://java.sun.com/j2se/1.4.2/docs/guide/security/jce/JCERefGuide.html .

Similar Messages

  • How can i create messenger with java tv API on STB

    deal all.
    how can i create messenger with java tv API on STB.
    how can Xlets communicate each other?
    how?
    i am interested in xlet communications with java tv.
    is it impossible or not?
    help all..

    You can create a messenger-style application using JavaTV fairly easily. JavaTV supports standard java.net, and so any IP-based connection is pretty easy to do. The hard part of the application will be text input, but people have been using cellphone keypads to send SMS messages for long enough that they're familiar with doing this. This doesn't work well for long messages, where you really need a decent keyboard, but for short SMS-type messages it's acceptable.
    The biggest problem that you need to work around is the return channel. Many receivers only have a dial-up connection, ties up the phone line and potentially costs people money if they don't get free local calls. Always-on return channels (e.g. ADSL or cable modem) are still pretty uncommon, so it's something that you nee to think about. Of course, if you do have an always-on connection then this problem just goes away.
    This is really one of those cases that's technically do-able, but the infrastructure may not be there to give users a good experience.
    Steve.

  • How to use parameter file with java

    Is it possible to use a parameter file with Java, and is there any class/method to make it easy to call and use these parameter from a text file, other than scanning the whole text file manually as we can do normally with visual basic/c++, so we can call the program with the parameter file, like java testing c:\\testing.ini

    If I understand you correctly, you may be looking for a properties file. This is basically a text file that contains pairs of strings in the form:
    parameter1=value1
    parameter2=value2
    parameter3=value3
    ...etc.
    and the values are retrieved using the java.util.Properties class - see:
    http://java.sun.com/j2se/1.3/docs/api/java/util/Properties.html
    Sample use://Call chis method once, to load the props file.
    //props file is called "demo.properties", and is
    //in a directory that is included in the classpath
        private void loadMyProperties() throws Exception
         InputStream stream = getResourceAsStream("/demo.properties");
         if(stream == null)
             throw new Exception("stream is null!");
         demoProperties = new Properties();
         demoProperties.load(stream);
         stream.close();
    // Then you can retrieve properties in your code using:
    String param3 = demoProperties.getProperty("parameter3");
    //...etc

  • How can I see file with chinese name in Sunray USB storage?

    hi, All
    I installed Sunray4u3 on Solaris0805. the application server is win2003EE.
    I accessed usb storage from win2003, but I can only see files with English name , and could not see files with chinese name. Why? who can help?
    best regards
    xiong wei

    You might want to make sure your credit card is listed in the billing information associated with your Apple ID (see http://support.apple.com/kb/ht1918).
    Also, to change the From name that appears when you address emails on and iOS device, go to Settings>Mail,Contacts,Calendars...tap your iCloud email account, tap you iCloud account at the top, tap Mail at the bottom, then enter the name you want to use in the Name field at the top.
    To change the From name on your Mac Mail, go to icloud.com, sign into your account, open Mail, click the gear shaped icon on the bottom left and choose Preferences, go to the Accounts tab and enter the name you want to use in the Full Name field and click Done.  Then quit Mail on your Mac and re-open it.  Your new From name should now appear in the drop-down list when you compose a new email.

  • How can you encrypt files?

    Hi, ive been working on an application and i have been wondering how u can encrypt files. I would appreciate any advice anyone could offer as to how you might come up with your own algorithm.
    Thanks
    Mike

    Why would you want to come up with your own encryption algorithm?
    Start here for encryption in Java:
    http://java.sun.com/j2se/1.4.2/docs/guide/security/CryptoSpec.html

  • Can't encrypt files with fingerprint reader

    I just bought a Toshiba E105-s1602 and I cant figure out how to encrypt files and folders with the fingerprint reader.
    I use it to log onto the computer and in the instructions it says just to right click on the file and there should be something that says encrypt or something similar, but I have no options having to do with encryption.
    Does anybody know how to use this, am I doing something wrong?
    Thanks

    As far as I know this option depends on preinstalled software. I am not 100% sure but Toshiba offers two different applications for this purposes.
    If such option is not available then this option is not offered by preinstalled application.

  • How can I associate file with my swing aplication

    I dont know if this section is correct, bud I couldnt find more suitable section for my problem.
    I have a swing aplication, and I have some saved serializabled objects (strings etc), what i need to do, to associate my files with system, so I can (after double-clicking on this file) open my application and load variables what are stored in it.
    thanks for replies

    for instance: I have program which has some variable...for example String s = "hello"then there is method save(File file)
    which has code:
    FileOutputStream fos = new FileOutputStream(file);
    ObjectOutputStream oos = new ObjectOutputStream(fos);
    try {
           oos.writeObject(s);
           oos.close();
    } catch (Exception e){
         // handle
    }I want that file (after double-click on it) to start my aplication, an initialize String s from this file.
    Like you can double-click on your favourite mp3 file, and it will automaticly open your winamp and initialize a playlist with this song
    I dont know if it is possible to do this via serialization. That why Im asking here.
    thanks for another replies :)

  • How can ipad share files with windows pc?

    Can the iPad be connected to a Windows 7 PC and used to share files between Word and Pages? 

    Word files can be opened and edited in Pages on the iPad and you can send the files to the iPad via email, by using a service like DropBox or by using iOS file sharing. This will explain how to use file sharing.
    http://support.apple.com/kb/HT4094
    You might want to be aware of the fact that some editing features will be lost from the Word files when you open them Pages - fonts will be limited - some formatting issues may arise - Pages on the iPad just doesn't work like Word on a computer.

  • Lion - how can I share files with another account on same computer

    Lion has dropped public files and airdrop only works over wifi.  How do I share files between two accounts on same computer?

    I found and turned on "system preferences  / file sharing"  but also had to go to Finder preferences and select show "Hard Disks" to be able to see other users public folder.

  • How can I trasfer file using java program (from NT to Unix)

    Hi all,
    I want to transfer a text file from Windows NT to Unix machine inside the Java program.
    How should i do it.
    Thanks in advance.
    Regards
    Rajeev

    you have several options:
    - make your system administrator software install software on Unix and NT so that you can see a directory on the Unix machine from your NT machine, and just copy the file there
    - use FTP to put the file on the Unix machine
    Jesper

  • How to display pdf file with java code?

    Hi All,
    i have a jsp pagein that page if i click one icon then my backing bean method will call and that method will create pdf document and write some the content in that file and now i want to display that generated pdf document.
    it should look like you have pressed one icon and it displayed pdf file to you to view.
    java code below:
    FacesContext fc = FacesContext.getCurrentInstance();
    ExternalContext ec = fc.getExternalContext();
    HttpServletResponse resp = (HttpServletResponse) ec.getResponse();
    resp.setHeader("Content-Disposition", "filename=\"" + temppdfFile);
    resp.encodeRedirectURL(temppdfFile.getAbsolutePath());
    resp.setContentType("application/pdf");
    ServletOutputStream out = resp.getOutputStream();
    ServletUtils.returnFile(temppdfFile, out);
    out.flush();
    and above temppdfFile is my generated pdf file.
    when i am executing this code, it was opening dialog box for save and cancel for the file, but the name of the file it was showing me the "jsp file name" with no file extention (in wich jsp file i am calling my backing bean method) and type is "Unknown File type" and from is "local host"
    it was not showing me open option so i am saving that file then that file saved as a pdffile with tha name of my jsp file and there is nothing in that file(i.e. empty file).
    what is the solution for this. there is any wrong in my code.
    Please suggest me.
    Thanks in advance
    Indira

    public Object buildBarCodes() throws Exception
    File bulkBarcodes = null;
    String tempPDFFile = this.makeTempDir();
    File tempDir = new File("BulkPDF_Files_Print");
    if(!tempDir.exists())
    tempDir.mkdir();
    bulkBarcodes = File.createTempFile
    (tempPDFFile, ".pdf", tempDir);
    //bulkBarcodes = new File(tempDir, tempPDFFile+"BulkBarcode"+"."+"pdf");
    if(!bulkBarcodes.exists())
    bulkBarcodes.createNewFile();
    Document document = new Document();
    FileOutputStream combinedOutput = new FileOutputStream(bulkBarcodes);
    PdfWriter.getInstance(document, combinedOutput);
    document.open();
    document.add(new Paragraph("\n"));
    document.add(new Paragraph("\n"));
    Image image = Image.getInstance(bc.generateBarcodeBytes(bc.getBarcode()));
    document.add(image);
    combinedOutput.flush();
    document.close();
    combinedOutput.close();
    FacesContext facesc = FacesContext.getCurrentInstance();
    ExternalContext ec = facesc.getExternalContext();
    HttpServletResponse resp = (HttpServletResponse) ec.getResponse();
    resp.setHeader("Content-Disposition", "inline: BulkBarcodes.pdf");
    resp.encodeRedirectURL(bulkBarcodes.getAbsolutePath());
    resp.setContentType("application/pdf");
    resp.setBufferSize(10000000);
    ServletOutputStream out = resp.getOutputStream();
    ServletUtils.returnFile(bulkBarcodes, out);
    out.flush();
    return "success";
    This is my action method which will call when ever i press a button in my jsp page.
    This method will create the barcode for the given barcode number and write that barcode image in pdf file
    (i saw that pdf file which i have created through my above method, This PDF file opening when i was opening manually and the data init that is also correct means successfully it writes the mage of that barcode)
    This method taking the jsp file to open because as earlier i said it was trying to open unknown file type document and i saved that file and opended with editplus and that was the jsp file in which file i am calling my action method I mean to say it was not taking the pdf file which i have created above it was taking the jsp file

  • How can I enable Safari with Java

    I want to run Java Applets from Safari.  from Anfyteam.com
    I am not finding a Java extension that will provide the Java framework needed to do this.
    thanks,
    Bill

    Run Java Preferences.app. It is in the Utilities folder. If you do not have Java Installed, it will download the latest appropriate version for you.
    If you are actually still on 10.6.7, you need to update to 10.6.8 and also Install any Security Updates that appear after you update to 10.6.8. You should do this BEFORE you enable Java.

  • How can I use tomcat with Java ServerFaces

    Is there a tutorial on Java ServerFaces using tomcat?

    the JWSDP1.3 download includes Tomcat
    Follow links from here - http://java.sun.com/webservices/index.jsp
    NOTES
    #1 JWSDP1.3 includes a Beta release of Tomcat 5
    So you may want to also download the latest version from the apache/Tomcat websites
    http://jakarta.apache.org/tomcat/index.html
    #2 JWSDP1.3 contains JSF EA4 - JSF 1.0 Beta is now available
    follow the link on the JWSDP web site above

  • How should i share file with other devices such as nokia,blackberry and etc using bluetooth

    I want to share  files between other deivce such as nokia but couldnt, could u help me tell how can i share files with other devices???

    @AKRBTN: Thanks for the reply and info.
    That is a solution, but it really isn't viable.
    It is sad that apple refuses to support this.
    A simple example: Sitting somewhere with no signal and you want to share a file (photo) with your colleague or friend, who happens to be right next to you.
    Or even if there is signal and you don't want to be paying fees or data charges.
    Or you may be in a rehearsal studio and need to share that very important file and have no time to go outside and get signal and try to send the file, which then everyone else has to go outside and catch the signal and pay fees.
    Anyway, I see that this is a dead end with apple, so I guess I will be back to carrying 2 phones around again.
    Peace,
    SB

  • I can't open or save file with Java Web Start

    Hi,
    i can't open or save file with Java Web Start:
    import java.io.*;
    import java.util.*;
    public class MetaDataFileCreator {
    public String fileNameSpace = null;
    public String fileName = null;
    protected Properties file = null;
    public MetaDataFileCreator(String fileNameSpace, String fileName) {
    this.fileNameSpace = fileNameSpace;
    this.fileName = fileName;
    public void createMetaDataFile() {
    try {
    System.out.println("file METADATA");
    ClassLoader cl = this.getClass().getClassLoader();
    String nameFileMetaData = fileNameSpace + fileName + ".txt";
    FileOutputStream fileOS = new FileOutputStream(cl.getResource(nameFileMetaData).getFile());
    file = new Properties();
    file.setProperty("aaaaa", "aaaa");
    file.store(fileOS, "");
    fileOS.close();
    } catch (Exception e) {
    System.out.println("Error writing metadata-file: " + e);
    System.exit(1);
    e.printStackTrace();
    I have try also to open a file like this:
    ClassLoader cl = this.getClass().getClassLoader();
    file.load(cl.getResourceAsStream(nameFile));
    also like this:
    try {
    fos = (FileOpenService)ServiceManager.lookup("javax.jnlp.FileOpenService");
    fss = (FileSaveService)ServiceManager.lookup("javax.jnlp.FileSaveService");
    } catch (UnavailableServiceException e) {
    fss = null;
    fos = null;
    System.out.println("Error with JNLP");
    System.exit(1);
    if (fss != null && fos != null) {
    try {
    // get a FileContents object to work with from the
    // FileOpenService
    FileContents fc = fos.openFileDialog(null, null);
    //FileContents newfc2 = fss.saveAsFileDialog(null, null, fc);
    // get the OutputStream and write the file back out
    if (fc.canWrite()) {
    // don't append
    os = fc.getOutputStream(false);
    } catch (Exception e) {
    e.printStackTrace();
    also like this:
    File f = new File((System.getProperty("user.home")+"x.txt").toString());
    FileOutputStream fileX = new FileOutputStream(f);
    OutputX = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fileX, "UTF8")));
    OutputX.println(....
    but it doesn't work with Java Web Start.
    Can someone help me?
    How can I open or save file?
    thank you.
    Sebastiano

    Did you specify <all-permissions/> in your JNLP file? Did you sign your code? What error are you getting?

Maybe you are looking for

  • I suspect there is a problem with the update

    Hello, I've just passed a few hell days of adjusting and reinstalling my computer. I was using Adobe Media player and the program asked me if I wanted to update it online. I clicked OK. the screen became blank gray for a moment. Then it worked all ri

  • How to print in atable

    Hi, I have requirement like when the condition satisfies it needs to print details in atabular format in output. Now I am just getting details not in any particular format, which is in while loop. Can you help me. import java.io.File; public class Ma

  • Keychain and Safari Auto Fill

    I've never been able to figure out the relationship between the Auto-Fill function in Safari and the Keychain program function that seeems to do the same thing. If anyone knows of any doumntation on this subject I would appreciate it. THE CURRENT PRO

  • Problem updaing a GridLayout JPanel

    Problem updaing a GridLayout JPanel What I want to do in the following method is very straight forward. First, I will remove all components inside the namesPanel, then reset the layout and add new things back to the panel. However, now it does not cl

  • HT201272 Im unable to find deteted apps in purchased section in App Store ..please help me in restoring the deleted app

    Im unable to find deteted apps in purchased section in App Store ..please help me in restoring the deleted app