How to obtain public key from a .crt file

Hi
I am new to cryptography Please correct me if my understanding regarding the digital signature is correct and i need help to get the public key.
I have a x.crt file which contains following fields
1) x
2)y
3) Certificate
this certificate contains following fields
certificate version
owner id
name
public key
signature (which is obtained by signing from start of x.crt till public key with private key)
now i need to verify whether the signature for that i need to get the public key & signature from this .crt file. Is it how i need to verify the certificate ?? please help me as I am a newbie in cryptography

Hi all
Thanks for the reply
So to get the public key now i used the following code
byte[] dataPub = new byte[256]; // size of the public key
try {
                    byteArrayInputStream.read(dataPub);
               } catch (IOException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
          BigInteger modulus = new BigInteger(dataPub);
     BigInteger exponent = new BigInteger("65537"); // specified in the document
     RSAPublicKeySpec rpks = new RSAPublicKeySpec(modulus, exponent);
     KeyFactory kf = null;
               try {
                    kf = KeyFactory.getInstance("RSA");
               } catch (NoSuchAlgorithmException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
     try {
                    pk = kf.generatePublic(rpks);
                    System.out.println("Pb Key----------------:"+pk.toString());
               } catch (InvalidKeySpecException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
When I convert the pk.toString I am getting a negative modulus value . Can the modulus value be negative ??
Edited by: 800317 on Oct 8, 2010 5:51 AM

Similar Messages

  • How can I read "Keys" from a Config File that have square brackets in them?

    I'm using the "Read Key (String).vi" from the config.llb and I'm having a problem because the key names in my file have square brackets in them. I'm creating an VI to read certain pieces of the TestStand �StationGlobals.ini� file and array elements appear as %[0] = "blah blah blah". It looks like they're not getting recognized at all. Is there a way to handle this?

    I was just looking at the code inside the configuration VIs and the way they work under V6 is that the Open VI actually reads the contents of the configuration file, parses it (in nice-platform independent G) and stores it in a fancy LV2-style global called the "Config Data Registry.vi". The routine that does the parsing is called "String to Config Data.vi". My gut reaction is that this code is going to be the same in your version because between sometime prior to V6 of LV, NI changed the location of a couple terminals on the low-level Match String function and it looks like when this code was originally written the terminals were in the old configuration.
    In any case, if your square-bracket containing strings are getting lost, this is probib
    ly where it's happening at. The other place to check is in the read VI itself. The V6 VI for reading the configuration registry is called "Config Data Get Key Value.vi". It's output is then further parsed by a function called "Parse Store String.vi" if the "read raw string?" input is set to False (the default position).
    Given that all the code for these functions are written in LV, you should be able to fix your VIs to read the strings you have in the ini file now. Which IMHO is actually the way they should work.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • How can I get keys from Hashtable in the same order?

    Hello, everyone.
    I have a Hashtable containing key-value pairs, I need to get the keys in the same order as I use
    method put(key,value) to save the key-value pairs. But I can only find Hashtable.keys() to fetch the keys in form of Enumeration and when retrieve the keys from the Enumeration,they are not in the original order!
    The following is my code:
    Hashtable ht = new Hashtable();
    ht.put("Name","Harry Bott");
    ht.put("Gender","Male");
    ht.put("Age","25");
    String[] Items = new String[ht.size()];
    Enumeration e = ht.keys();
    int i = 0;
    while(e.hasMoreElements()) {
    Items[i++] =(String)(e.nextElement());
    The Items contains the keys but they are not in the original order.
    Does anyone know how to get the keys from a Hashtable in the same order when they're put?
    Thank you!

    yeah, another solution is to stored keys on a Collection at the same time you put them on the HashMap with its values.
    Then when ur going to retrieve objects from the Map u iterate the Collection that has the ordered keys and use them.

  • How to transfer license key from Windows to Mac for adobe photoshop lightroom 5?

    how to transfer license key from Windows to Mac for adobe photoshop lightroom 5?

    You can download from this link and validate with your serial number. You can run LR5 on both machines.
    http://www.adobe.com/support/downloads/detail.jsp?ftpID=5856

  • How to migrate public folders from legacy (exchange 2003 ) to exchange 2010

    How to migrate public folders from legacy (exchange 2003 ) to exchange 2010 . Please suggest ?
    Aditya Mediratta

    Hi Aditya,
    please find the answer in
    http://blogs.technet.com/b/agobbi/archive/2010/08/04/how-to-move-public-folder-from-exchange-2003-to-exchagne-2010.aspx
    Please ensure you have a working mailflow from Exchange 2003 to 2010, vice versa, before you begin. 
    Basically it's the same procedure as adding some PF Database in E2K3; just
    run .\AddReplicaToPFRecursive.ps1 -server "Exchange 2010 Server" -TopPublicFolder "\" -ServerToAdd "Exchange 2010 Server"
    Wait until some initial data started to replicate; after that run
    Update-PublicFolderHierarchy -Server "Exchange 2010 Server"
    After replication has finished you can do a
    .\MoveAllReplicas.ps1 -Server "Exchange 2003 Server" -NewServer "Exchange 2010 Server"
    Please let me know if it worked.
    Kind regards,
    Martin

  • Retreiving only particular keys from a properties file

    hello friends,
    can someone kindly tell me , is there any way to retreive only particular keys from a properties file .
    for e.g the file is as follows
    abc.properties
    ad_1 = "hello"
    ad_1_fg = "bye"
    ad_1_hj = "dfd"
    ad_1_jk = "sdfsdf"
    bk_2_jk = "sdfdsf"
    bk_2_lk = "klklk"
    so lets say at run time , i get the key ad_1 , and i am told to retreive all the keys from the properties file starting only with ad_1, then how do i do it.
    I tried using ResourceBundl,PropertyResourceBundle, but they all get all the keys, and tehre is no way to specify within them that get only keys with particular format.
    please do help me

    Retrieve all the properties, and then loop over them
    looking for those whose names match the pattern you
    need.hello jverd thanks for your quick response, i was thinking the same, but lets say i retreive all keys, then how do i match them to my pattern, i mean if some keys is like this jhk_ad_1 , so i dont want that , i only want keys starting from ad_1 , hope u got what i am trying to say.
    i mean i want all the keys that are starting from the runtime value i am getting

  • How to call a function from a JAR file

    Hi ALL,
    I am trying to call a Public function from a JAR file from my JAVA
    file. Can you please provide an example or suggest a good resource?
    Basically my java file Test.Java should call a function called 'export_a_doc' from a JAR file Export.jar. How do I refer this in my Java file and call 'export_a_doc'?
    Thanx

    Hi,
    HERE IS MY JAVA FILE
    // We need this for Starting our Export Process
    import com.newexport.Myclass;
    public class MyTest {
         // Our function to Start Export
         protected static void test(String[] args) {
         System.out.println("Starting. \n---------------------");
         Myclass p = new Myclass();
         try {
    p.Start_Export(args);
    System.out.println("Finished. \n---------------------");
         } catch(Exception e) {
    e.printStackTrace();
         public static void main(String[] args) {
         test(args);
    HERE IS THE BATCH FILE TO BUILD AND RUN
    cd \JNI\Srcs
    echo "-------------"
    c:\JBuilder7\jdk1.3.1\bin\javac -classpath C:\JNI\Export.jar MyTest.java
    echo "-------------"
    \JBuilder7\jdk1.3.1\bin\java.exe -classpath c:\JNI\Export.jar MyTest
    The Export.jar uses other jar files
    Raj

  • How can I copy layers from one .fla file to another .fla file?

    Hi,
    How can I copy layers from one .fla file to another .fla file? Please do help.
    Thanks.

    Select all the frames you want to copy, right click and select copy frames then select the file you want to paste them into and right click again and then paste frames.
    The layers the frames are should come across with them.

  • How can i import contacts from a csv file to "iCloud Contacts"?

    How can I import contacts from a csv file to "iCloud Contacts"?

    The only way I know of to import cells from a csv file is by creating a new file.  But then you can select the desired cells and copy them to the other file.  I just did it to be sure it works.
    1. Create the new spreadsheet file via the upload command.
    2. Select the cells (table) that you want to move to the other file and press command+C (copy).
    3. Close the new file and open the existing file.
    4. Select the top/right cell of the area to receive the copied "table" and press commant+V (paste).
    I hope this is what you're trying to do!

  • How can I keep lion from generating .DS_Store files on windows network partitions, but not disable it for all network partitions?

    How can I keep lion from generating .DS_Store files on windows network partitions, but not disable it for all network partitions?  I am fimilar with changing the setting for all network partitions(defaults write com.apple.desktopservices DSDontWriteNetworkStores true), but that is undesirable when I connect my laptop to my home network. A preferable solution would be where I could control the writing of these files based on disk format (NTFS vs HFS+).

    Go to MacUpdate or CNET Downloads and search for ds_store. There are numerous utilities for preventing them from being transferred to Windows systems.

  • Need how to get the data from the external file in eCatt

    Hi ,
      Could any body suggest how to get the values from the external file(Excel,CSV file,Text file) and pass it as varaiable in ecatt Test script.
    Problem: Need to execute FK01-Vendor creation Transaction with multiple set of data .As per my understanding we could achive through Variants in Testdata set in eCatt .
    But is there any way to store the data in excell file and get the data and pass it to FK01 Test scripts
    Appreciate response on this

    Hi
    See the links they may be useful
    check these link,
    eCATT- An Introduction
    /people/sumeet.kaul/blog/2005/07/26/ecatt-an-introduction
    Creating Test Scripts
    /people/sumeet.kaul/blog/2005/08/10/ecatt-creating-test-scripts
    eCATT Logs
    /people/sapna.modi/blog/2006/04/18/ecatt-logs-part-vi
    eCATT Scripts Creation – TCD Mode
    /people/sapna.modi/blog/2006/04/10/ecatt-scripts-creation-150-tcd-mode-part-ii
    Creation of Test Data Container
    /people/sumeet.kaul/blog/2005/08/24/ecatt-creation-of-test-data-container
    eCATT Scripts Creation - SAPGUI Mode
    /people/sapna.modi/blog/2006/04/10/ecatt-scripts-creation--sapgui-mode-part-iii
    Integrating ECATT & MERCURY QTP Part -1
    /people/community.user/blog/2007/01/02/integrating-ecatt-mercury-qtp-part-1
    Using eCatt to Test Web Dynpro ABAP
    /people/thomas.jung/blog/2006/03/21/using-ecatt-to-test-web-dynpro-abap
    and
    -command reference
    http://help.sap.com/saphelp_nw04/helpdata/en/c6/3c333b40389c46e10000000a114084/content.htm
    /people/sapna.modi/blog/2006/04/10/ecatt--an-introduction-part-i
    http://prasadbabu.blogspot.com
    https://www.sdn.sap.com/sdn/developerareas/was.sdn?page=test_tool_integration_for_sap_e-catt.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/1b/e81c3b84e65e7be10000000a11402f/frameset.htm
    http://www.erpgenie.com/ecatt/index.htm
    hope this helps.
    Reward points for useful Answers
    Regards
    Anji

  • How to remove a click from a sequence file mp4 or mp3, and make it only sequence left and right in GarageBand?

    How to remove a click from a sequence file mp4 or mp3, and make it only sequence left and right in GarageBand?

    "adrianTNT" <[email protected]> wrote in message
    news:e6aitv$hkm$[email protected]..
    >
    quote:
    Originally posted by:
    kglad
    > you're welcome. with your solution loading another mp3,
    are you sure it stops
    > the download of the first mp3?
    > Yes, it seems to work fine, it loads another sound in
    same sound (my_sound)
    > and it seems to replace loaded progress with the empty
    sound I gave and stops
    > previous loading.
    > I look at traffic icons on task bar and I see that there
    is no network traffic
    > after I click "stop" before this I could see continuous
    traffic while sound was
    > loading in background.
    Yeah, I remember someone posted that solution a long time
    ago. It seems if you load a file with the same name the cache
    doesn't
    know any better and adjusts the download size to the smaller
    one. Maybe it's a good way to do it! Could it be a way to remove an
    mp3 from someone's cache after it plays? hmmmm Will have to
    do more testing.
    tralfaz

  • How can I print stuff from the 'Help' file using my MacBook Air?

    How can I print stuff from the 'Help' file using my MacBook Air?

    Open the Help viewer, select a category then from the menu bar top of your screen, click File > Print

  • How do I stop LR4 from organizing imported files into a folder by date.

    How do I stop LR4 from organizing imported files into a folder by date. Most times when I import files I have already created a folder and sub-folder structure tyat I want to use. I then right click the desired folder and choose import into this folder option. Why does LR4 insist on organizing my already selected destination into a sub-folder with a date by default?

    TimHillPhotography23 wrote:
    Most times when I import files I have already created a folder and sub-folder structure tyat I want to use.
    If you do it this way all the time consider a different approach:
    Manually copy your images from the card into your desired destination folder in the Finder/Explorer. Once complete drag&drop that entire folder into Lightroom. When the import dialog pops up select to Add the images to the catalog (not copy or move). You will end up with the exact folder structure reflected in your library.

  • How to get Public Key Remainder?

    Hi Friends..
    Sorry, i have a little doubt regarding the Public Key Remainder..
    What is Public Key Remainder used for?.. is it a part of Public Key?.. How to get it from Public Key, especially in Java?
    As far as i know that the Public Key is constructed with Modulus and Exponent, and with this we can Encrypt and Verify data was signed by Private Key..
    In Java, we can expose Public Key's modulus and public exponent using RSAPublicKey, there's no method to expose Public Key's Remainder..
    Please help me regarding this..
    Thanks

    Leonardo Carreira wrote:
    Hi Shane,
    Thanks for your reply.. :)
    safarmer wrote:
    In that case the exponent and remainder are you public key (exponent and modulus) and the certificate is defined in the definitions section of Book 3. It is a secure way of verifying the public key and it's owner through a trusted certification authority.
    EMV Book 3 tends to use Remainder and Modulus interchangeably.You mean, the Issuer (in this case one of E,M, and V) should provide 2 certificates for 1 card?..
    This is implemented on SDA or DDA?..
    Sorry, i'm still have no idea..
    The Remainder and Modulus should be used interchangeably?..
    How the Host and Card can decides in each transaction whether it will use Remainder or Modulus?..I mean that the terminology is used interchangeably. They refer to the same thing as far as the actual key is concerned.
    Cheers,
    Shane

Maybe you are looking for

  • Slim, a problem with virtual consoles and a question about reboot

    hi, just installed slim but now when I switch to the virtual consoles my session on X starts firing keyboard events on the consoles I have there, how can I fix that? I'm using xmonad, my terminal is sakura and I'm starting slim from /etc/inittab and

  • Can I use wifi bridge to connect wirelessly to Hum...

    I am expecting my Humax box next week, with Powerline adapters. Could I safely use an Ethernet to WiFi bridge instead?. One such device is NETGEAR WNCE2001-100PES Universal Wireless-N to Ethernet Internet Adapter. This can be powered from a USB port.

  • Smaller Viewing Area on TV

    Novice user here of iMovie. Have a lower quality clip and want to create an iDVD and have it display/play on the TV in a smaller frame so that the movie isn't so distorted. How do I do this?

  • Adding Custom Images to Selphy Printing software?

    Is there a way to add custom images to the Clip Art, or Frame entities within the Selphy Printing software?

  • Aperture won't complete import

    Aperture will import all photos without a problem, but when it reaches the last photo it hangs. Aperture doesn't become unresponsive, it just never completes the import. I've been having this problem off and on for a few weeks. I rebuilt my library w