Saving keys in java

Hi,
i have the following problem: i want to save the generated keypair(RSA/DSA/X509) so that i can use it again later. I have to use Base64 for RSA/DSA.
unfortunatly there was little info on the web about those problems (generating keys is good explained), so i am stuck in the middle of nowhere..
can anyone help me solve the problem?

I found this solution on http://forum.java.sun.com/. It is embarrassingly simple:
import java.awt.*;
import java.awt.image.*;
import java.io.*;
import javax.imageio.*;
import javax.swing.*;
public class SaveSwing
public static void main(String[] args)
JFrame jframe = new JFrame("Hello there!");
jframe.setBounds(100, 100, 300, 200);
Container cp = jframe.getContentPane();
cp.add(new JLabel("Can you save me?"));
jframe.show();
BufferedImage image = new BufferedImage(cp.getWidth(), cp.getHeight(),
BufferedImage.TYPE3BYTEBGR);
cp.paint(image.getGraphics());
try { ImageIO.write(image, "jpg", new File("jframe.jpg")); }
catch(Throwable thr) { thr.printStackTrace(); }
System.exit(0);
}

Similar Messages

  • Import Manager 'Error 5611520 - Error Saving Key Mapping'

    I am using CREDITOR_EXTRACT in R/3 to send Vendor IDoc to XI and use CREMDM04 type.  XI generates an XML file that I load into MDM using a client that is set up for Inbound/Outbound.  The key mappings have been turned on for the Vendor repository.
    In IM, I use the standard map CREMDM04 and the system maps the incoming XML file to the vendor main table.  There are few values that I have to map manually - fine.  Next, when I click Import, I get a error pop-up message 'Error Saving Key Mapping - Errno 5611520'.
    Has anybody experienced this when using all standard content (schemas and maps) for Vendor?
    Thanks in advance.

    Subbu,
    Found another system that has the same versions as you do.  This particular error did not appear, but we got some internal IM error.  Also, the SAP training demos are on the same versions as mine.
    I am using MDC R/3 as the client and the CREMDM04 schema map.  Not using MDM inbound ports for now.  Just loading XML file generated by XI based on CREMDM04. Do you think that I need to define a Qualified Range for this client in the Console or can it be left blank?
    Thanks.

  • Getting generated keys inside Java

    Is there any way to get generated keys in Java running on CF
    server?
    I have some java code accessed from CF, I get a connection to
    the data source by name via
    "coldfusion.server.DataSourceService.getDatasource(datasourceName).getConnection()"
    call within java, which works. However if I try to do a
    connection.prepareStatement(sql,
    PreparedStatement.RETURN_GENERATED_KEYS) call or
    preparedStatement.getGeneratedKeyts() call I get a
    "java.lang.AbstractMethodError" exception like:
    java.lang.AbstractMethodError:
    coldfusion.server.j2ee.sql.JRunConnectionHandle.prepareStatement(Ljava/lang/String;I)Ljav a/sql/PreparedStatement;
    Which seems to indicate to me that CF does not implement
    getting generated keys via JDBC - is there another way or do I have
    to just give up and do a "select" after "insert"?
    Hope this made sense.
    Thanks,
    -HH
    P.S. In case this is usefull, CF MX7 with MSSQL2005 , JDK
    1.4

    Hichhiker wrote:
    > Is there any way to get generated keys in Java running
    on CF server?
    CF6/7 uses JDBC 2 so I don't think you can get it to work
    there. In CF 8
    it should work (if your database supports it).
    Jochem
    Jochem van Dieten
    Adobe Community Expert for ColdFusion

  • Logic crashes when using the "Close Project without Saving" key command

    The "Close Project without Saving" key command does not work in LP8. When I try to use it, Logic crashes. This is reproducible on my system. Can anyone try and confirm this?

    For me this shortcut is quite important on stage when I have to switch songs as fast as possible. It also is foolproof because on stage I never want to save with all the controller changes I did during a performance.
    Just hit the key command, load the next song, done.
    Message was edited by: cronbg

  • Since the last update yesterday to firefox 4.0.1 my program "asus security protect manager" doesn't work properly. That means, that the saved keys from several websites not remembered for lock in.

    since the last update yesterday to firefox 4.0.1 my program “asus security protect manager” doesn’t work properly. That means, that the saved keys from several websites not remembered for lock in.

    Sorry you are having problems. First of all try Fifrefox's safemode.
    *[[Troubleshoot Firefox issues using Safe Mode]]
    If that works post back for further advice.
    Next step, if safe mode did not work.
    <u>First: Try a clean install, <sub>(you have had a none standard version installed previously)</sub></u><br /> that involves deleting the program files. Then if necessary try troubleshooting by creating and using a clean empty Firefox profile.
    See
    * this recent post [/questions/940399#answer-377134]
    * http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Clean_reinstall
    <u>Second: try a New Profile</u>
    *http://kb.mozillazine.org/Profile_Manager#Creating_a_new_profile
    * this will be an additional profile, it is still worth backing up any existing or currently working profile on a regular basis
    **[[Back up and restore information in Firefox profiles]]
    * Until you are absolutely confident about the repercussions I suggest
    ** always use an empty folder when creating a new profile
    ** never delete or rename profiles, just disable or remove shortcuts
    ** after creating a new test profile open it and check for any addons or plugins that may be have been included by default

  • Is there a way to create/edit registry keys with Java?

    I'm writing a console app and I'd like to have it so the users can change values in the registry. I'm not just talking about app keys I want any key. Is there a way to do this with Java?

    Maybe a forum search on "Windows registry" would turn up some useful things. You're not the first to ask this. You might save yourself and everyone else some time if you'd simply do that.

  • How to store a RSA pair key in Java Key Store (jks) and VS

    Hi Everyone ,
    I have generated a RSA pair key . now I need to store my public key in a Java Key Store (.jks file) . and then I need to read this .jks file in another application and get this public key to use for verification .
    I'll appreciate it if anyone could help me with this matter with a sample code for import/export public key to/from a java key store file or any hints.
    Best Regards,
    Vivian

    I don't think this makes sense. How have you generated an RSA key pair and where is the result stored?

  • Solution Manager Key for Java AS

    I'm new to SAP Netweaver so maybe this question has been answered before.
    I need to install SAP Netweaver AS Java for development/QA purposes. I understand that I  need also Solution manager key for installation so I installed another Solution Manager System.
    When I enter to Solution Manager http://<server>:50000 I get "System Landscape Directory is not accessible. Only local system can be administered". What does it mean? I remember I chose to create local SLD.
    I saw also in couple of threads the following:
    Just go to transaction SMSY transaction of solman and locate the system for which you need to generate Solman Key and just right clilck on that system...You will find the option of Generating Solution Manager Key....
    I don't have such an option when I enter to Solution Manager.
    Any suggestions?
    Thanks,
    Haim Beyhan

    Hi,
    For Solman key generation refer the link below, which has the screen shots.
    http://www.saptechies.com/step-by-step-procedure-to-generate-solution-manager-key-smsy-solution-manager-40/
    Regards,
    Ravi

  • Errors with partitioning by callback or keys (JNI/Java), bug?

    Hello,
    Just upgraded to 4.8, to test new partitioning features. Seems to be not working for me, or maybe I'm doing something wrong?
    Vista 64-bit, Java 1.6.0_16 32-bit, BDB 4.8.24 32-bit.
    Callback-based partitioning:
    public class InfoDataPartitionHandler implements PartitionHandler {
    @Override
    public int partition(Database db, DatabaseEntry key) {
         return 0; // just testing
    DatabaseConfig cfg = new DatabaseConfig();
    cfg.setAllowCreate(true);
    cfg.setPartitionByCallback(4, new InfoDataPartitionHandler());
    cfg.setType(DatabaseType.BTREE);
    Database db = env.openDatabase(null,"test",null,cfg);
    And this is what I get when running, looks like a bug actually:
    Exception in thread "main" java.lang.IllegalArgumentException: DatabaseEntry must not be null
    at com.sleepycat.db.internal.db_javaJNI.Db_set_partition(Native Method)
    at com.sleepycat.db.internal.Db.set_partition(Db.java:497)
    at com.sleepycat.db.DatabaseConfig.configureDatabase(DatabaseConfig.java:2206)
    at com.sleepycat.db.DatabaseConfig.openDatabase(DatabaseConfig.java:2105)
    at com.sleepycat.db.Environment.openDatabase(Environment.java:314)
    Key-based partitioning
    Things are even worse.
    DatabaseEntry k1 = new DatabaseEntry();
    StringBinding.stringToEntry("111111111111111111111111", k1);
    int sz = k1.getSize();
    MultipleDataEntry keys = new MultipleDataEntry(new byte[sz]);
    keys.append(k1);
    DatabaseConfig cfg = new DatabaseConfig();
    cfg.setAllowCreate(true);
    cfg.setPartitionByRange(2, keys);
    cfg.setType(DatabaseType.BTREE);
    Database db = new Database("/tmp/test.db", null, cfg);
    db.close();
    Exception in thread "main" com.sleepycat.db.DatabaseException: DB_NOTFOUND: No matching key/data pair found: DB_NOTFOUND: No matching key/data pair found
    at com.sleepycat.db.internal.db_javaJNI.Db_open(Native Method)
    at com.sleepycat.db.internal.Db.open(Db.java:449)
    at com.sleepycat.db.DatabaseConfig.openDatabase(DatabaseConfig.java:2106)
    at com.sleepycat.db.Database.<init>(Database.java:103)
    at Temp.main(Temp.java:23)
    Please help.

    Hello. Thanks for this report, both situations you've reported are bugs in Berkeley DB. We are currently validating patches internally.
    Please contact me directly at ben dot schmeckpeper at the obvious domain.
    Thanks,
    Ben

  • Generating & Recognizing keys in java

    Hi
    After running an ant target ( that checks java code for correct coding conventions ex variable naming conventions , proper indentation etc ) I need to generate a 16 digit (or more) code
    When developer tries to checkin his code its required that he/she must enter this code else he/she wont be allowed to checkin
    Not sure how to generate and recognize the keys ?? are there any libraries available for same ??
    Any algorithm to implement the same welcome, this code wont work on client side , just a check to make sure code quality improves
    Edited by: lav on Feb 23, 2010 6:48 AM

    lav wrote:
    Hi
    After running an ant target ( that checks java code for correct coding conventions ex variable naming conventions , proper indentation etc ) I need to generate a 16 digit (or more) code
    When developer tries to checkin his code its required that he/she must enter this code else he/she wont be allowed to checkin
    Not sure how to generate and recognize the keys ?? are there any libraries available for same ??
    Any algorithm to implement the same welcome, this code wont work on client side , just a check to make sure code quality improves
    I don't understand what this has to do with 'security' but you can use the Hex encoding of the MD5/SHA1/SHA2 digest of the file.
    P.S. Your developers will really really love you if you force them to manually enter a 16 digit code whenever they check in some code. You must automate this.

  • Obtaining keys from java.util.TreeMap values (help)

    I don't know how i can obtain the keys from the values in the java.util.TreeMap. I can iterate through the key-values collection, but i don't know how i can specify a value to obtain a key.

    That's because Maps map keys to values, not the other way around. If you want to see what key(s) (there may be none or many) map to a particular value, you must examine all values in the Map. You could instead have two Maps, one to map keys to values and the other to map values to keys.

  • I need to retrieve an Object[] of all keys in java.util.Hashtable

    public abstract class ArrayFunctionality {
         * Construct {@link java.lang.Object} array of keys from {@link java.util.Hashtable}
         * @param h {@link java.util.Hashtable}
         * @return array {@link java.lang.String}
         * @throws java.lang.IndexOutOfBoundsException Exception thrown if initial {@link java.lang.Object} array paramater cannot be indexed
        public static Object[] arrayKeys(Hashtable<Object, Object> h) throws IndexOutOfBoundsException {
            Vector<Object> v = new Vector<Object>();
            Enumeration keys = h.keys();
            while (keys.hasMoreElements()) v.add(keys.nextElement());
            return v.toArray();
    // HOWEVER, this occurs with Hashtable<String, String> attrs:
    if (hasSetHashtable) String[] keyArray = ArrayFunctionality.arrayKeys(attrs);
    // DOES NOT COMPILE: ".class expected - not a statement"I am not understanding why this is occurring, please advise, I'm lost on this one.
    Thanx
    Phil

    I still don't understand what you mean but it now
    works..
    I am sorry I just don't understand the difference
    between
    if (hasSetHashtable) {
    String[] keyArray;
    keyArray = ArrayFunctionality.arrayKeys(attrs);
    }AND
    if (hasSetHashtable) {
    String[] keyArray =
    ArrayFunctionality.arrayKeys(attrs);PhilThere is no difference between those two you posted. The difference is between
    String[] keyArray;
    if (...) {
        keyArray = ArrayFunctionality.arrayKeys(attrs);
    }and
    if (...) {
         String[] keyArray;
         keyArray = ArrayFunctionality.arrayKeys(attrs);
    }In the first, the keyArray will exist outside of the scope of the if statement. In the second, the keyArray will no longer exist once you leave the if statement. Which is the same thing jbish said.

  • Does " Close Project without Saving " key assignment work at all ?

    I'm using Logic Express 8. I'd really like to be able to close a project without seeing the " do I want to save the project " box.
    There is a function to do that in the Keypress Commands, but it seems broken. I've tried assigning several different keypress combinations to that function and all they do is crash Logic when I try to use them.
    So, am I doing something wrong, missing something, or is that command broken ?
    ???

    Come on, how hard would it be for someone out there to try this and let me know if it's my problem .. or a bug ?
    Logic Express Preferences ... Key Commands .... Global Commands ... Close Project without Saving.... assign some key combo to that, then go back to a project and try it.
    Oh, and then fill out the cute - report this to Apple- thing when it pops up after the crash so someone will fix this and I can move on

  • Trapping and making use of keyboard keys in java

    hello friends,
    wish to seek your advice and help once again. i'm trying to create a 'calculator' application using java. i've created buttons that represent such keys like: '*', '/', '\', '+', '-' etc. and '1', '2', '3', '4', '5' etc. but i don't know what to do so that when i click on the button '2' and then the button '*' and again the button '5' and finally on the button '='; it will know how to multiply '2' with '5' and give me a result of '10' on the textfield. please, any advice from someone will be appreciated. thanks in advance.

    If it's just clicking on a button you're asking, you need to add an actionListener to each button, then in actionPerformed() you need to identify the button to determine what action to take
    e.g. if the button is 0 to 9, displayTextfield += button.getText()
    if the button is +, currentTotal += displayTextfield.getText() etc
    I have a working calculator at a website, which might give you a few ideas. A lot of the code deals with a strip list, and the order of the + - / * = keys
    e.g if I want to deduct 2 from 4, the keystrokes are 4+2- , not like small calculators 4-2=
    http://michael-dunn.freeservers.com/java/Calculator.htm

  • Daylight saving patches to java certified by oracle

    Which version of JVM needs to be installed in Oracle, by which we can make Java API calls from database using dbms_java to support daylight saving in US ?
    US Daylight saving time changes are being patched by SUN in all versions of Java. But has Oracle certified all of these versions ?
    If there is a JRE 1.3 installed on Oracle 9i, can the daylight saving patches be applied to this version ? Is there any info from Oracle regarding this ?

    Hi,
    See if this link help you:
    http://www.oracle.com/technology/tech/java/index.html
    Cheers

Maybe you are looking for

  • Adobe Acrobat Professional 8 - User Manual

    I just upgraded to Adobe Acrobat Professional 8 and looking for a printed manual. Any suggestions on best purchase? Any feedback on the "Adobe Acrobat 8 PDF Bible"?

  • Warning Drop Frame Capture

    Alright, here's my scenario: I captured some HDV footage and now I want to capture the same clips, but I want to do it in regular DV. I've gotten the drop frame capture warning and have tried to capture them without luck. Is this even possible becaus

  • Producer Consumer Query.

    I am Testing a small example of the Producer Consumer example using synchronized. I have a very important query which I need to ask: class Q has 2 synchronized methods,one to get() and one to put(). class Producer and Consumer both have a reference t

  • Maximum Digits for Extension in Callmanager 4.X

    What's the official maximum number of digits for extensions in CM 4.x? The error message says it's 24 and I got this information that it is supposed to support 32.

  • LR5.6 won't import video files

    After upgrading from 5.0 to 5.5 & 5.6 LR won't import video files. Also won't play previously imported video files. Shows only previews. Any ideas to fix this?