Best way to store an AES Key

Hello,
I'm currently developing a little "file vault" , with graphical interface, to enable end users to encrypt/decrypt some of their personal files on teh filesystem
I'm currently using AES as Cipher :
the first time the user launches the UI, i generate an key for AES then store it (encoded as Base64) in Registry (if Windows) using java.util.Preferences
Doing this, later, the application automatically retrieves this key for decrypt/encrypt tasks.
Is this the best way to store this kind of key.
I currently ask myself if i couldn't (as second option) leave the user choose a key first : the user should then retype this key at every launch of the application to be able to decrypt/encrypt his files.
What is the best way?
Laurent

As far as i understand in the document PKCS#5 , to do my application, i should use the PBES2 (password based encryption scheme 2), respecting the following steps :
Encryption:
1) Select a Password (P) : this password is not stored on the system, the user will provide it to the application for every operation (dec / enc)
2) Select a Salt (S) : i wonder if first time i should use a pseudo random generator, then store the Salt on the System (where on Windows or Linux?...)
3) Select an iteration Count (c) : should be > 1000
4) select a derived key Length (dkLen)
5) Create a derived key (DK) using the formula : DK = DKF(P,S,c,dkLen)
6) Encrypt clear Message M using the Derived Key (DK) an the algorithm AES, to obtain the Cipher Text (C)
Decryption:
Repeat steps 1 to 5
6) Decrypt Cipher Text (C) using DK and AES algorithm to obtain the clear message (M)
Does it sound good for you.
My question is always the same :
Should i hard code in my application the Salt ,the Iteration Count, and the derived key length or , should i first generate a pseudo random Salt, then store it on the file system (Windows Registry, File)
Any idea?
Laurent
Message was edited by:
Laurent_Bois

Similar Messages

  • Best way to store a secret ket in DB

    If I have a SecretKey obj, what is the best way to store it in DB?
    Can I stroe a string (new String(SecretKey.getEncoded()))? then use String.getBytes() when getting it back from DB to create the same key?
    Thanks,

    to oversimplify even more:
    NIST calculates you should be fine with AES & a keylength
    minimum of 128 bits until the year 2031 by using Moore's Law.
    just keep your plaintext out of memory as long as possible
    if your that paranoid, and load it via a CipherInputStream.
    all i'm saying is that no algorithm or process is 100% safe,
    the main goal is to keep the information as hard to break for
    the specific period of time.
    what i did with my KeyStore was to save the SecretKeys in a 4D
    BinaryTree and save the entire KeyStore in a SealedObject
    using PBEWithMD5AndDES. all i have to do is memorize a really
    long password. i applied a Thread so that you only have 5 - 10
    seconds to enter the password.
    so far i've had minimal problems, i induce garbace collection
    and create as much decoy "memory noise" as possible.
    so i just made an encrypted database that holds my SecretKeys

  • Best Way to store references to other objects

    Hi there,
    I want to design a class, that has several references to other instances. What is the best way to store such references within the class? As a vector? As a Hash-Table?
    What I need are:
    -get a certain element in this data-structure fast (let's say the fifth)
    -be able to list all elements referenced
    -delete a certain element (e.g. 5th one out of 10)
    What I do not necissarily need is:
    -to be able to search if a certain object is referenced by this one
    What do you propose?
    Any ideas?
    Thx
    Karlheinz Toni

    Any thoughts on hashtables etc?
    I used them in an application where i needed to get
    objects quickly. It allowed me to get the objects
    based on a criteria instead of by the object itself.
    It was really useful for me.Use HashMap instead of Hashtable. HashMap would also work but you can't get element 5 unless you use the element number as a key. If you do use the element number as the key, it's kind of like using a List except it won't renumber itself, which you may or may not want. For example, if you remove element 5 from a List element 6 (if it exists) becomes element 5. If you remove key 5 from the HashMap you just don't have an element 5 anymore i.e. the map will return null for get(new Integer(5));

  • What is the best way to store and search 2D data

    Hi,
    There is a set of data (~10k records ) in 2D dimension.
    like this :
    Col 1, Col 2, Col3....
    What is the best way to store and search those records ?
    Thanks in advance
    Wilson

    Hi,
    Either userObjet[][] if you know how much data you have, and the data size is fixed, or use a list of lists. E.g. A Vector of Vectors (some will probably say that you should use an ArrayList instead, and that could be the case, but it sounds like you would want to display the data later on, and a DefaultTableModel (for JTables) uses a Vector as data holder).
    Kaj

  • What's the best way to store my info externally

    I have recently bought my first Macbook Pro 13" with 2.4 Ghz. I am currently using it for my own business and do tend to get a lot of files together. I went to look at "About this Mac" and have already got 369 Gb used up in storage... I have no idea how I have done that as I have hardly downloaded any apps on this computer besides the ones that were on here. I did download Vware Fusion 4 as I have a reservation system which I used to run on my pc and need to have this on here too so perhaps that software takes a lot of space.
    Could anyone advise on which is the best way to store my info externally, will any external harddrive do, or do you need a special one for Apple or Macbook pro. I am just asking as I have no idea and prefer to buy the right one straight away.
    Any help would be much appreciated !
    Thanks, Sara***

    Sara,
    The most reliable method is to use an external hard drive.  Some are better than others, but most will work.
    For the least amount of setup pain, I prefer to deal with the Mac specialists at OWC, http://www.macsales.com as they stand behind their products with great warranty and support.  I have one of their Mercury Elite Pro 2 TB drives that has multiple interface capability so you can get a fast interface for data transfer.
    Take a look at what they offer and see what fits your needs.  If you have more questions about doing thin, just ask on here.
    Ralph

  • Best way to store data from a plot on hard drive

    I have a DAQ set-up that will be on 24/7 for several days, and the whole time it's streaming data to an XY-Graph with a limited buffer.  My question is, what's the best way to store my plot data in such a way that I can empty out my plot every few hours but if I want to pull up data from a few hours ago I would just have an option on my initial VI to view any old saved plot data.
    Basically, I'm trying to not overload my RAM with all my plot data so I'd like to save it to the hard drive while my VI is running, and only display, for example the last 8 hours worth of data... I've been looking at TDMS, but I'm not sure if that's the right solution.  
    much thanks!

    Hi,
    You could save your data using TDMS as well as ASCII to simply load it in another application later.
    Attached VI shows you how to save your data to a File after a certain amount of iterations, you can combine this then with your code and a timestamp.
    Christian
    Attachments:
    Save to new file every N samples.vi ‏20 KB

  • Best way to store documents and images in a web application

    All,
    Which is the best way to store the documents, is it Oracle DB or file system or Virtual Directory Mapping in weblogic.
    We are working on a Internet based application into CRM domain, there is a requirement where user can upload and download the documents (.pdf, .xls, .doc etc). Right now we are storing images in the DB. Is it advisable to store all the docs in database and will it scale up in future.
    PS: There is no scope for using content server because of business constraints.
    Please let me know, thanks in advance.
    Regards
    Girish

    Best way to store depends entirely on requirements.
    Why store it in the database when it for example is purely static images (e.g. used as part of the web GUI)? Instead that can be served up directly by a web server - which is specifically designed for this.
    If it is more than just an image, but include tags (non spatial data attributes), requires transaction control (e.g. updating an old passport/id photo with a newer one), auditing, filtering/searching and ordering, requires backup, needs security and access controls, and so on - than that is most definitely a database function.
    So the issue is not what the binary file is or contains - an image or pdf or something else. It depends entirely on how it is to be used and what the business requirements are in this respect.

  • What's the best way to store old FCP projects & media?

    Hey
    I've started to accumulate more and more video content of client projects, but I don't want to delete it in case they come back a year later looking for an update on the video product I made them.
    So, what's he best way to store FCP projects and video files?
    I thought maybe a BluRay burner might do the trick.
    Any suggestions?
    Sam

    Since you're using RAW files you might peruse the DAM Forum to learn about possible other DAM (digital asset management) software and workflows. There is a wealth of information at that site.
    I useMedia Expression for my primary DAM application and iPhoto for special projects like books, calendars, etc.

  • Can you suggest a best way to store and read arabic from oracle database?

    Hi ,
    can you suggest a best way to store and read arabic from oracle database?
    My oracle database is Oracle Database 10g Release 10.1.0.5.0 - 64bit Production on unix HP-UX ia64.
    NLS_NCHAR_CHARACTERSET AL16UTF16
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CHARACTERSET WE8ISO8859P1
    I have presently stored the data in nvarchar2 field. But i am not able to display it correctly.

    Using the national characterset should work but there are other factors that you have to consider when working with NCHAR/NVARCHAR2/NCLOB.
    If possible, changing the characterset is usually the best solution if it's a possiblity for you.
    For more info:
    Dear Gurus: Can u pls explain the difference between VARCHAR2 & NVARCHAR2??

  • Best way to store big amount of data

    Hi, i need to store a big amount of data, written in a txt its size is almost 12 mg, anyway it depends on the computer it runs, beacause what i want to store is all the shared files in a computer.
    Which is the best way to store it? Array string? textfile? List? I don�t need the data after the app close.
    Thanks

    Well, then which is the best solution? LinkedList or
    Tree? i only need to store the full path.
    What i didn�t say, my fail, is that i need to search
    for a file name once i have stored them...For searching, LinkedList will be very slow if it's very large. I think the same is true of javax.swing .tree.DefaultTreeModel, which is the JDK's only tree implementation. I don't know what Jakarta-collections has - it's possible they have a tree that offers fast searching. If you want to stick to the standard Java libraries, you'll want a Set for fast searching. TreeSet keeps the entries in sorted order. If you also need to display them as a tree, you can keep them in both a Set and a tree. If you don't have enough memory to do that, then displaying the whole tree isn't going to be useful to the user anyway, so rethink your goal.

  • Best way to store TenantID in Azure

    I'm developing a multi tenant application
    I am using ASP.NET MVC and Asp.net Identity for authentication
    My client can have more than one company and you can change, user have multiple company
    I wonder what is the best way to store the TenantID in azure
    Claims?
    I'm Claims my value is:
    Type = "TenantId"
    Value = is Guid ( difficult or impossible to be guessed by changing the value of the cookie )
    Cache?
    Session ["TenatId"]?
    Router? {tenantid}}/controller/action

    Hi
    When you get a Graph Token from AAD, it has an Issuer claim in the Claims that has the TenantId in it, so you don't need to store the TenantId in a different claim:
    Sample issuer claim:<Issuer>https://sts.windows.net/cbb1a5ac-f33b-45fa-9bf5-f37db0fed422/</Issuer>For your reference of all available claims in AAD token take a look at here:https://msdn.microsoft.com/en-us/library/azure/dn195587.aspx#BKMK_TokenClaims
    Regards
    Aram

  • Best way to store constants

    I'm working on a set of drivers that call functions from a DLL provided by the instrument manufacturer.  They have an extremely detailed manual, which has been very helpful.  When they describe the functions (and the different values I can pass), they use named constants, and then at the end they define the value of each constant.
    This sort of thing works great in a text-based programming language: just assign the appropriate values to the constants at the beginning and you're ready to go.  But what's the best way to store these constants in LabVIEW?
    My initial approach was to use (strictly typedef'd) text rings (or occasionally enums): the constant name was the text string, and the numeric value was the value of that string.  The problem is that they occasionally have multiple constants with the same numeric value, and LabVIEW doesn't let you have duplicate values in a text ring.
    The thing I really like about using text rings is that this way, I have all of the values at hand to use in a control or a constant; I just plop down the appropriate text ring and select the constant I want.  It's also easy to keep consistent across all of the VIs in the project, since it's a typedef.
    But...since it looks like this won't work, at least not completely, what's the best alternative?  Enums wired to case structures that pass out the appropriate value?  Dual arrays, one with the constant name and the other with the value?  Something else?  The downside is that all of the above need some sort of wrapper VI, but I can't think of a way around that.  What would you do? 

    > It's also easy to keep consistent across all of the VIs in the project, since it's a typedef.
    Unlike an enum, the ring's data isn't really part of the typedef. If you drop a (strict typedef) ring constant on the diagram, the data is only up-to-date as of when the constant is dropped on the diagram; it isn't dynamically updated to reflect changes in the data of the underlying typedef. (And of course anything goes with non-strictly typedef rings, where you can set the strings at runtime.)
    As for the best solution, I don't know. Despite the above problems with rings I have still used them for this purpose since usually the definitions don't change with time. Your idea of using an typedef enum + case statement in a VI seems like the safest approach for constants that can have duplicate or nonconsecutive values.
    Message Edited by Rob Calhoun on 08-25-2009 02:52 PM
    Message Edited by Rob Calhoun on 08-25-2009 02:54 PM

  • Best way to store a lot of image files??

    I am working on a new project which involve user upload image to server and then do searching and view image. there will be a lot of image files. image will be displayed in web page as thumbnails, so there may be resized pic stored in server or resize on the fly.
    What is the best way to store image like this? as files in file system? database? etc...?
    Thank you very much

    Since seraching is invloved use a database. A file system is not good place to search in.
    Using a database will allow you to store additional data as well such as comments about the images or the ratings given by the users.
    Of course you will have to develop a propper table structure for this.
    Also do not generate thumbnails all the time instead cache them once they are created. Atleast the thumbnails of the images that are displayed often.
    Also store the last updted dates with the images so you can loow the images to be cached by the clients or the proxy server. That will reduce repatitive requests for the same image from same client.

  • What is the best way to store a battery?

    Hi,
    I have an extra MBP battery. What is the best way to store this extra battery? Should I store it when it is fully charged? or Should I store it when it is half full? Is it necessary to use that batter once in a while?
    Thank you beforehand.
    Bob

    http://www.apple.com/batteries/notebooks.html
    If you're storing it for a long time, put it away when it's about half full. If you have a couple of batteries for your MacBook, I'd recommend swapping batteries once a month or so to extend the life of both batteries.

  • Swapped Hard Drive - Best Way to Store original HDD?

    What is the best way to store my swapped out HDD?
    I put it in one of these silicon cases:
    http://eshop.macsales.com/item/NewerTech/HDANTISH25/
    Can I then put it in a zip lock bag? Will that cause moisture?
    Any thoughts or advice will be greatly appreciated!

    OWC has some great enclosures!
    http://eshop.macsales.com/item/Other%20World%20Computing/MEQM0GBK/
    or
    http://eshop.macsales.com/shop/USB2/OWC_Express
    Put in one of these and use it as a back up drive or extra storage!  That is what I do whenever I upgrade my internal drive.

Maybe you are looking for

  • Be Warned - Mavericks is not compatible with Microsoft Office 365!!!!!!!!!!!!!!!

    Be Warned - Mavericks is not compatible with Microsoft Office 365!!!!!!!!!!!!!!!  I upgraded to Mavericks on 4 seperate computers, an 2 iMacs, MBPro and an MBAir and ALL four no longer connect to Microsoft Office 365 email accounts either with Office

  • Issue with installing itunes on a Windows 7 OS

    I'm getting this message when trying to install itunes on to my Windows 7 pc: "This installation package could not be opened. Verify that the packages exist and that you can open it, or contact the application vendor to verify that this is a valid Wi

  • How to change last page header under TOP-OF-PAGE in a report

    hi, there are 20 pages in the report for which same header is diplayed for 20 pages by using follow. TOP-OF-PAGE. PERFORM write_doc_header. now the requirement is to change the last page heading. for this i've another perform statement. so plz let me

  • Hard Disk Space ? Confused!!

    I don't know if this makes any sense, but I only have 1500 songs in itunes and not many pictures on iphoto but I get a message saying that my hard disk is almost full when I try to download or update something. My friend has over 10,000 songs on her

  • Query not retrieving exact results.

    I have a query which shows different result from what i have it in the cube. I have a document number in rows and two key figures one amount and another  which shows no. of days for clearance. In the cube, for the same selection criteria , it gives m