How can I hardcode the public key into my coding?

Hi! I need to hardcode the public key into my program so can someone tell me how can i do it.
Purpose:-
I am trying to create a license file( signature file) and the public key in my product.

Hi! Thank for your reply.
I dont understand, but anywhere i get the solution already.
Thanks.
byte[] pubKey = pub.getEncoded();
                String hexPubKey = toHexString(pubKey);
                FileOutputStream pubKeyfos = new FileOutputStream("suepubk");
                PrintWriter pwPubKey = new PrintWriter(pubKeyfos);
                pwPubKey.write("PublicKey="+hexPubKey);
                pwPubKey.close();the following method i got it from internet. I forget the link.
private static String toHexString(byte[] block) {
        StringBuffer buf = new StringBuffer();
        int len = block.length;
        for (int i = 0; i < len; i++) {
             byte2hex(block, buf);
//if (i < len-1) {
// buf.append(":");
return buf.toString();

Similar Messages

  • Can I put RSA Public Key into the ISD in the JCOP?

    Dear All,
    Can I put RSA Public Key into the ISD in the JCOP? the command I put into the card as follows:
    cm> /terminal "winscard:4|FT SCR2000 0"
    --Opening terminal
    /atrresetCard with timeout: 0 (ms)
    --Waiting for card...
    ATR=3B 69 00 FF 4A 43 4F 50 34 31 56 32 32 ;i..JCOP41V22
    ATR: T=0, N=-1, Hist="JCOP41V22"
    /card -a a000000003000000 -c com.ibm.jc.CardManagerresetCard with timeout: 0 (ms)
    --Waiting for card...
    ATR=3B 69 00 FF 4A 43 4F 50 34 31 56 32 32 ;i..JCOP41V22
    ATR: T=0, N=-1, Hist="JCOP41V22"
    => 00 A4 04 00 08 A0 00 00 00 03 00 00 00 00 ..............
    (86244 usec)
    <= 6F 10 84 08 A0 00 00 00 03 00 00 00 A5 04 9F 65 o..............e
    01 FF 90 00 ....
    Status: No Error
    cm> set-key 255/1/DES-ECB/404142434445464748494a4b4c4d4e4f 255/2/DES-ECB/404142434445464748494a4b4c4d4e4f 255/3/DES-ECB/404142434445464748494a4b4c4d4e4f
    cm> init-update 255
    => 80 50 00 00 08 51 39 AE 8E 0C 8B D9 50 00 .P...Q9.....P.
    (132953 usec)
    <= 00 00 63 06 00 26 29 91 06 75 FF 02 00 84 FC 69 ..c..&)..u.....i
    60 80 B4 9C 9C 03 DB 99 9E F8 F4 67 90 00 `..........g..
    Status: No Error
    cm> ext-auth plain
    => 84 82 00 00 10 E6 A4 12 36 FD 7E 57 D0 2B 9D 5F ........6.~W.+._
    65 30 D8 1B 00 e0...
    (89378 usec)
    <= 90 00 ..
    Status: No Error
    cm> put-key --mode add 115/1/RSA-PUB/0301000180ad97a22fe7cb29accc3a0b68844f0cb11d057ed8c80c5a4db856138030c419d0a27556902a939152ce79376b1cd0955ce4303bf7560c95230714c583ff8a8f12f1cf23d867e469773d15f0e708332651110cb615c8d373e86d57b5ffe7ff44bcc7690a4d68cbe07743b19879ac5beaeef6e1af133a1fd37b86a5339960b36e53
    => 80 D8 00 01 88 73 A1 80 AD 97 A2 2F E7 CB 29 AC .....s...../..).
    CC 3A 0B 68 84 4F 0C B1 1D 05 7E D8 C8 0C 5A 4D .:.h.O....~...ZM
    B8 56 13 80 30 C4 19 D0 A2 75 56 90 2A 93 91 52 .V..0....uV.*..R
    CE 79 37 6B 1C D0 95 5C E4 30 3B F7 56 0C 95 23 .y7k...\.0;.V..#
    07 14 C5 83 FF 8A 8F 12 F1 CF 23 D8 67 E4 69 77 ..........#.g.iw
    3D 15 F0 E7 08 33 26 51 11 0C B6 15 C8 D3 73 E8 =....3&Q......s.
    6D 57 B5 FF E7 FF 44 BC C7 69 0A 4D 68 CB E0 77 mW....D..i.Mh..w
    43 B1 98 79 AC 5B EA EE F6 E1 AF 13 3A 1F D3 7B C..y.[......:..{
    86 A5 33 99 60 B3 6E 53 A0 03 01 00 01 00 ..3.`.nS......
    (281664 usec)
    <= 6A 86 j.
    Status: Incorrect parameters (P1,P2)
    jcshell: Error code: 6a86 (Incorrect parameters (P1,P2))
    jcshell: Wrong response APDU: 6A86
    Why the card return error code ? I think the P1 P2 is correct, according to the GP2.1.1?
    Thank you!

    It also can't input the RSA Public Key to the card, as follows:
    cm> /terminal "winscard:4|FT SCR2000 0"
    --Opening terminal
    /atrresetCard with timeout: 0 (ms)
    --Waiting for card...
    ATR=3B E9 00 00 81 31 FE 45 4A 43 4F 50 34 31 56 32 ;....1.EJCOP41V2
    32 A7 2.
    ATR: T=1, N=0, IFSC=254, BWI=4/CWI=5, Hist="JCOP41V22"
    /card -a a000000003000000 -c com.ibm.jc.CardManagerresetCard with timeout: 0 (ms)
    --Waiting for card...
    ATR=3B E9 00 00 81 31 FE 45 4A 43 4F 50 34 31 56 32 ;....1.EJCOP41V2
    32 A7 2.
    ATR: T=1, N=0, IFSC=254, BWI=4/CWI=5, Hist="JCOP41V22"
    => 00 A4 04 00 08 A0 00 00 00 03 00 00 00 00 ..............
    (86180 usec)
    <= 6F 10 84 08 A0 00 00 00 03 00 00 00 A5 04 9F 65 o..............e
    01 FF 90 00 ....
    Status: No Error
    cm> set-key 255/1/DES-ECB/404142434445464748494a4b4c4d4e4f 255/2/DES-ECB/404142434445464748494a4b4c4d4e4f 255/3/DES-ECB/404142434445464748494a4b4c4d4e4f
    cm> init-update 255
    => 80 50 00 00 08 80 29 78 6F 21 1B 34 89 00 .P....)xo!.4..
    (129908 usec)
    <= 00 00 63 06 00 26 29 91 06 75 FF 02 00 00 93 73 ..c..&)..u.....s
    3A B8 2C 0F D2 4C 06 E2 50 66 7F D8 90 00 :.,..L..Pf....
    Status: No Error
    cm> ext-auth plain
    => 84 82 00 00 10 3E 88 4D 33 FD 7D A5 56 B6 90 84 .....>.M3.}.V...
    78 94 BD B3 7A x...z
    (97237 usec)
    <= 90 00 ..
    Status: No Error
    cm> card-info
    => 80 F2 80 00 02 4F 00 00 .....O..
    (60917 usec)
    <= 08 A0 00 00 00 03 00 00 00 01 9E 90 00 .............
    Status: No Error
    => 80 F2 40 00 02 4F 00 00 [email protected]..
    (41315 usec)
    <= 6A 88 j.
    Status: Reference data not found
    => 80 F2 10 00 02 4F 00 00 .....O..
    (73177 usec)
    <= 07 A0 00 00 00 03 53 50 01 00 01 08 A0 00 00 00 ......SP........
    03 53 50 41 90 00 .SPA..
    Status: No Error
    Card Manager AID : A000000003000000
    Card Manager state : OP_READY
    Load File : LOADED (--------) A0000000035350 (Security Domain)
    Module : A000000003535041
    cm> install -b -s -i A000000003535041 A0000000035350 A000000003535041
    => 80 E6 0C 00 20 07 A0 00 00 00 03 53 50 08 A0 00 .... ......SP...
    00 00 03 53 50 41 08 A0 00 00 00 03 53 50 41 01 ...SPA......SPA.
    C0 02 C9 00 00 00 ......
    (227436 usec)
    <= 90 00 ..
    Status: No Error
    cm> ls
    => 80 F2 80 00 02 4F 00 00 .....O..
    (61204 usec)
    <= 08 A0 00 00 00 03 00 00 00 01 9E 90 00 .............
    Status: No Error
    => 80 F2 40 00 02 4F 00 00 [email protected]..
    (66302 usec)
    <= 08 A0 00 00 00 03 53 50 41 07 C0 90 00 ......SPA....
    Status: No Error
    => 80 F2 10 00 02 4F 00 00 .....O..
    (72365 usec)
    <= 07 A0 00 00 00 03 53 50 01 00 01 08 A0 00 00 00 ......SP........
    03 53 50 41 90 00 .SPA..
    Status: No Error
    Card Manager AID : A000000003000000
    Card Manager state : OP_READY
    Sec. Domain: SELECTABLE (SV------) A000000003535041
    Load File : LOADED (--------) A0000000035350 (Security Domain)
    Module : A000000003535041
    cm> select A000000003535041
    => 00 A4 04 00 08 A0 00 00 00 03 00 00 00 00 ..............
    (84625 usec)
    <= 6F 10 84 08 A0 00 00 00 03 00 00 00 A5 04 9F 65 o..............e
    01 FF 90 00 ....
    Status: No Error
    cm> /card -a a000000003000000 -c com.ibm.jc.CardManager
    resetCard with timeout: 0 (ms)
    --Waiting for card...
    ATR=3B E9 00 00 81 31 FE 45 4A 43 4F 50 34 31 56 32 ;....1.EJCOP41V2
    32 A7 2.
    ATR: T=1, N=0, IFSC=254, BWI=4/CWI=5, Hist="JCOP41V22"
    => 00 A4 04 00 08 A0 00 00 00 03 00 00 00 00 ..............
    (83836 usec)
    <= 6F 10 84 08 A0 00 00 00 03 00 00 00 A5 04 9F 65 o..............e
    01 FF 90 00 ....
    Status: No Error
    cm> set-key 255/1/DES-ECB/404142434445464748494a4b4c4d4e4f 255/2/DES-ECB/404142434445464748494a4b4c4d4e4f 255/3/DES-ECB/404142434445464748494a4b4c4d4e4f
    cm> init-update 255
    => 80 50 00 00 08 FA 3B 98 E7 B4 60 A8 CC 00 .P....;...`...
    (128562 usec)
    <= 00 00 63 06 00 26 29 91 06 75 FF 02 00 01 26 F7 ..c..&)..u....&.
    25 4D B0 B9 D2 1D 18 99 F1 1F E8 25 90 00 %M.........%..
    Status: No Error
    cm> ext-auth plain
    => 84 82 00 00 10 C9 5D 27 4B C4 54 AC E5 D3 3C 8B ......]'K.T...<.
    5F 2D B5 6B 87 _-.k.
    (97825 usec)
    <= 90 00 ..
    Status: No Error
    cm> set-key 1/1/DES-ECB/505152535455565758595a5b5c5d5e5f 1/2/DES-ECB/505152535455565758595a5b5c5d5e5f 1/3/DES-ECB/505152535455565758595a5b5c5d5e5f
    cm> put-keyset 1
    => 80 D8 00 81 43 01 80 10 B3 6A 9E 82 2D 9E 8E 06 ....C....j..-...
    8F B9 52 EA CA 63 FA 6B 03 A4 B7 D6 80 10 B3 6A ..R..c.k.......j
    9E 82 2D 9E 8E 06 8F B9 52 EA CA 63 FA 6B 03 A4 ..-.....R..c.k..
    B7 D6 80 10 B3 6A 9E 82 2D 9E 8E 06 8F B9 52 EA .....j..-.....R.
    CA 63 FA 6B 03 A4 B7 D6 00 .c.k.....
    (263198 usec)
    <= 01 A4 B7 D6 A4 B7 D6 A4 B7 D6 90 00 ............
    Status: No Error
    cm> put-key 115/1/RSA-PUB/0301000180ad97a22fe7cb29accc3a0b68844f0cb11d057ed8c80c5a4db856138030c419d0a27556902a939152ce79376b1cd0955ce4303bf7560c95230714c583ff8a8f12f1cf23d867e469773d15f0e708332651110cb615c8d373e86d57b5ffe7ff44bcc7690a4d68cbe07743b19879ac5beaeef6e1af133a1fd37b86a5339960b36e53
    => 80 D8 00 01 88 73 A1 80 AD 97 A2 2F E7 CB 29 AC .....s...../..).
    CC 3A 0B 68 84 4F 0C B1 1D 05 7E D8 C8 0C 5A 4D .:.h.O....~...ZM
    B8 56 13 80 30 C4 19 D0 A2 75 56 90 2A 93 91 52 .V..0....uV.*..R
    CE 79 37 6B 1C D0 95 5C E4 30 3B F7 56 0C 95 23 .y7k...\.0;.V..#
    07 14 C5 83 FF 8A 8F 12 F1 CF 23 D8 67 E4 69 77 ..........#.g.iw
    3D 15 F0 E7 08 33 26 51 11 0C B6 15 C8 D3 73 E8 =....3&Q......s.
    6D 57 B5 FF E7 FF 44 BC C7 69 0A 4D 68 CB E0 77 mW....D..i.Mh..w
    43 B1 98 79 AC 5B EA EE F6 E1 AF 13 3A 1F D3 7B C..y.[......:..{
    86 A5 33 99 60 B3 6E 53 A0 03 01 00 01 00 ..3.`.nS......
    (251210 usec)
    <= 6A 80 j.
    Status: Wrong data
    Add new key set didn't work, try modify ...
    jcshell: Error code: -3 (Invalid API parameter)
    jcshell: Command failed: Invalid RSA public key
    Is it something wrong ?

  • How can I convert the volume directory into a single file installer?

    How can I convert the volume directory into a single file installer? I would like to hide all the miscillaneous files that I don't care for and be able to have the installer double click a single file and have it automatically install.

    On the second prompt screen when prompted 'What kind of self-extracting Zip file file do you want to make?'
    Are you choosing the second option (self-extracting Zip file for software installation)?
    I have a word file that I created to help me remember - is there anyway to email it to you?

  • How can I hold the public IP on a specific profile on the asa 5510

    Hi Guys
    How can I hold the public IP on my cisco client VPN NAT session so nobody else can use it? I have a cisco asas 5510
    inside is 172.10.20.86
    public 166.245.192.90
    Did I need to call my ISP?
    thanks

    sorry
    I willl like to lock or reserve the public IP  address from a NAT session on the ASA vpn.
    that way a sepcific profile and public IP can be use all the time. I know how on the inside IP but not on the public IP.
    it make sense

  • How can we include the property value into the News RSS?

    We have defined object property u201CDepartmentu201D that is used in News XML creating form. How can we include the property value into the News RSS (set value of the particular RSS XML tag)?

    We have solved the issue with NWDS

  • How can I read the trace data into LabVIEW for E5071B

    HI 
    I am setting up the measurement using vector network analyzer (VNA) E5071B controlled by NI 488.2. How can I read the trace data into LabVIEW and display on the graph? If anyone having an idea or know well about this process please give me the suggestion, I will much appreciate it.
    Many Thanks

    You want to start with the driver
     In case you do not know it, you can do the driver search in LabVIEW from Tools>Instrumentation>Find Instrument Drivers. You might also want to bookmark the Instrument Driver Network for information on what a driver is and how to use it.

  • How can i disable the Enter key in JTextArea?

    How can i disable the Enter key in JTextArea?
    When i press Enter key in JTextArea,I hope JTextArea do nothing.
    Thanks!

    HI, I've the same problem;
    uncle_alice solution works fine, but if I paste in textArea a multi-line text,
    this last results on more lines (rows);
    Isn't possible to avoid this?
    Alternatively, how can I disable cut/copy/paste on TextArea?
    Thank you in advance.
    MargNat
    Message was edited by:
    MargNat

  • How can we automate the Depreciation keys based on production for business

    How can we automate the Depreciation keys based on production for business u2013 this is currently not an optimised process if we expect business to manually change the keyu2019s on a monthly basis.
    The end user updates the table, transaction AO25, manually on month end after the production calculations are completed. The question is, is it possible when the PP is completed, that the system updates the Period Unit table for that period?
    Thanks.
    Regards,
    PS PS

    Hi,
    I am new at this, so I need a explanation on how will this help me, and how do I get about doing this?
    Thanks a lot.
    Regards,
    PS PS

  • I'm using LR 5.6.  The Enter key should increase the exposure but it increases Contrast instead.  How can I make the Enter key adjust the exposure?

    Hello
    As explained in the heading, I'm using LR 5.6 on a PC (Win 7).  The Enter key should increase the exposure but it increases Contrast instead.  How can I make the Enter key adjust the exposure, as it should?  I have reset the settings to Default in the Develop module but to no avail.  Please help!  Thanks.
    Kind Regards
    Farrukh Hyder

    I am not aware that the ENTER key should increase exposure, and it certainly does not increase exposure (or any other slider) on my Lightroom 5.6 (Windows 7)
    If you click on the word Exposure, then the + and - keys increases or decrease exposure by 0.1 or -0.1

  • How can I disable the control key?

    How can I disable the control key?
    My Controll-Key is permanently pressed.... i dont know why, please help me!

    Take it to an Apple store or dealer to get it repaired.

  • How can I obtain the primary key of a table for an entity relation?

    hello everybody
    I am doing a consultation to a table in my data base, good this table has alone two fields, the first one is the code or pk and the second one is the description, to be presisos they are names of city and code.
    From the beginning!!: This method this one in another class that is a Dialog that is going to call to the class SelecPlace ();
      SelecPlace sl = new SelecPlace();
    public void capturarLugar(){  //  Simple void method in the mentioned class
            String place = txtProcedencia.getText() ;  //  a JTextField
            sl.executeStatement(place) ;                  
        }ok, now we see part of the code of the class SelectPlace
    public class SelecPlace extends AbstractTableModel{
        Connection con = null;
        Statement sentencia = null ;
        ResultSet rs = null;
        ResultSetMetaData rsmd = null ;
        String[] nameColum = {} ;
        Vector datos = new Vector() ;
        public SelecPlace() { }
        public void executeStatement(String query){
          try{
             con = DBManager.getConnection() ;
             sentencia = con.createStatement(rs.TYPE_SCROLL_INSENSITIVE,
                                                                          rs.CONCUR_UPDATABLE) ;
             String sql = "select * from Place where descripcion like %"+query+"%'";
              rs = sentencia.executeQuery(sql) ;
              rsmd = rs.getMetaData();
              int nroColumnas = rsmd.getColumnCount() ;
              nameColum = new String[nroColumnas] ;
              //obtengo los nombres de columnas en cache
               for(int colum = 0; colum < nroColumnas; columna++){
                    nameColum[colum] = rsmd.getColumnLabel(columna + 1) ;
               datos = new Vector();
                while(rs.next()){
                    Vector newRow = new Vector();
                    for(int i = 0; i < getColumnCount(); i++){
                    newRow.addElement(rs.getObject("place_ID"));
                    newRow.addElement(rs.getObject("description"));
                    datos.addElement(nuevaFila);
                fireTableChanged(null);
            }catch(SQLException e){
                System.err.println(e);
                e.printStackTrace(System.err);
                System.out.println("error in statement");
            }catch(ClassNotFoundException cnfe){
                System.err.println(cnfe);
        }Ok, this code me works and I obtain in this case the field description of the table Place
    Now my question is, how can I obtain the primary field of my table?
    I need this value of this field that in the base of information in a bigint, and to take it to the first class before mentioned, for that I am working with a data base related

    Certain duffymo and everyone!!, good I give you my scheme:
    And generalizing my question, I want to obtain the value of the primary key of a table in the database, I obtain more values of the same row, but I need the primary key, and you see one with the primary key I want to turn a Long and it to insert with code java in foreign clave in another table of the database
    Good of this form I believe that it would not be breaking the integrity relacional of the tables

  • I inadvertinly removed my contacts from my Address app on my iPad. it is still on our other iPad and our two iPhones. How can I import the contacts back into our iPad

    I inadvertinly removed my infocontact information  from my wikes "Contacts" App. The contact app still works in my iPad and both of our iPhones..
    How can I restore the contact info in her Contact app??
    Thanks

    Have you tried syncing them across iCloud? There is a nice tutorial here: http://www.gottabemobile.com/2011/10/18/how-to-sync-email-contacts-and-calendar- with-icloud/

  • How can I use the enter key instead of tab to change field focus?

    I am using Acrobat 9 Pro.
    We have a fillable PDF where the users enter numbers into fields.  They want to be able to use the <enter> key on the 10-key pad instead of the <tab> key on the keyboard to move the focus to the next data entry field.
    How can I set my PDF so that it recognizes the <enter> key instead of the <tab> key for changing focus?
    Thanks!

    You can use a custom Keystroke script, something like:
    // Custom Keystroke script for text field
    if (event.willCommit && event.commitKey === 2) {
        getField("Text2").setFocus();
    Where "Text2" is the name of the next field. This doesn't disable the Tab key though. For more information, see: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.608.html

  • I have converted/copied my itunes oto mp3 format to play on my PC. unfortunatly I didi not specify a different folder fro the mp3's. I therefore have itunes side by side with my mp3's all in the same folder. How can I remove the mp3's into another folder.

    I have converted my itunes on my imac to mp3 format so i could play them on my pc. unfortunatly  i did not specify a seperate folder for the mp3's to be sent to once converted.
    i now have itunes and mp3's side by side in the itunes media folder. this has the effect of doubling my library.
    how can i get rid of the mp3's from this folder en mass, other than erasing them one by one, there are 7000!!!

    Click on 'Music' in the iTunes sidebar. Look to see whether you have a 'Kind' column:
    If you haven't, choose 'View Options' from the 'View' menu and check 'Kind':
    Now go to the Music list again and click on the label of the 'Kind' column. This will group all your AACs and MP3s together. Locate the MP3s: click on the top one. Hold the shift key and click on the bottom one to select them all. If you want to save them drag them to a folder on your Desktop. Then hit 'Delete'. IMPORTANT: when promted, choose to have them moved to the Trash, otherwise they will be removed from the list but kept in the actual library.

  • How can I get the Icloud photos into my pc?

    Hello Buddy...
    I'm having problems to get my photos from my icloud into my computer.
    In the shared photos of icloud in my computer just show 165 photos but on my device I can see that I have 400 photos on my icloud.
    How could I get all this photos from my icloud? could you help me how can I proceed?
    TKS
    Look to hear you soon.

    Upgrade to Windows 7 or above

Maybe you are looking for