Results 1 to 6 of 6
  1. #1
    Deepa is offline Member
    Join Date
    Nov 2008
    Posts
    85
    Rep Power
    0

    Default Err:java.io.IOException: public key ring doesn't start with public key tag

    Hi,
    When i'm going to run the below program,i'm getting the error in red color text what i have mentioned in coding as follows

    Error Msg:
    java.io.IOException: public key ring doesn't start with public key tag
    Program:
    Java Code:
    public static PGPPublicKey pgpCheck()
    
    	{
    		PGPPublicKey pkey=null;
    	            StringBuffer encoded64 = new StringBuffer();
    
    	            try {
    
    	            BufferedReader rdr = new BufferedReader(new FileReader("C:\\key.txt"));
    
    	            String line = rdr.readLine();
    
    	            while (line != null)
    
    	            {
    
    	                        encoded64.append(line);
    
    	                        line = rdr.readLine();
    
    	            }
    
    	            rdr.close();
    
    	            System.out.println("Result string is...\n" + encoded64.toString());
    
    	           [COLOR="Red"] PGPPublicKeyRing keyring = new PGPPublicKeyRing(Base64.decode(encoded64.toString().getBytes()));[/COLOR]
    
    	            pkey = keyring.getPublicKey();
    
    	            System.out.println("Public key: id - " + pkey.getKeyID());
    
    	            System.out.println(" : Alg - " + pkey.getAlgorithm());
    
    	            }
    
    	            catch (IOException ioex)
    
    	            {
    
    	                        ioex.printStackTrace();
    
    	            }
    	            return pkey;
    	}

  2. #2
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    10

    Default

    Your keyring is not formatted or encoded correctly
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  3. #3
    Deepa is offline Member
    Join Date
    Nov 2008
    Posts
    85
    Rep Power
    0

    Default Re:

    How can i format or encode the Keyring....Plz anyone help...

  4. #4
    Deepa is offline Member
    Join Date
    Nov 2008
    Posts
    85
    Rep Power
    0

    Default Re:

    Anyone help...How to resolve the above problem...

  5. #5
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    450
    Rep Power
    10

    Default

    i was not able to understand your full program .But my sugg is that you can throw the IOException in the function instead of using Try and catch block.
    Mak
    (Living @ Virtual World)

  6. #6
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    450
    Rep Power
    10

    Default

    i think if you paste your java file here ,You can get right way soon
    Mak
    (Living @ Virtual World)

Similar Threads

  1. Replies: 9
    Last Post: 11-23-2008, 12:03 AM
  2. public instance method
    By steve123 in forum New To Java
    Replies: 5
    Last Post: 06-20-2008, 09:45 PM
  3. why we use public access modifier?
    By vichet in forum New To Java
    Replies: 1
    Last Post: 04-04-2008, 08:04 AM
  4. Public Holidays (Australia)
    By oranjeBoven in forum Advanced Java
    Replies: 0
    Last Post: 02-13-2008, 09:14 AM
  5. public method
    By dirtycash in forum New To Java
    Replies: 4
    Last Post: 11-21-2007, 08:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •