Results 1 to 2 of 2
  1. #1
    sanjubaba is offline Member
    Join Date
    Oct 2014
    Posts
    1
    Rep Power
    0

    Unhappy Re: Exception in PGP Decryption

    Hi,
    I want to encrypt and decrypt a txt file by using PGP.I completed my PGP Encryption.I'm getting an error in PGP Decryption. The error msg as follows


    Quote:
    Exception in thread "main" java.lang.IllegalArgumentException: Invalid PGP message
    at com.newpackage.bouncy.PGPUtils.getDataList(PGPUtil s.java:502)
    at com.newpackage.bouncy.PGPUtils.decryptFile(PGPUtil s.java:198)
    at com.newpackage.bouncy.PGPFileProcessor.decrypt(PGP FileProcessor.java:56)
    at com.newpackage.bouncy.Tester.testDecrypt(Tester.ja va:46)
    at com.newpackage.bouncy.Tester.main(Tester.java:61)
    I am getting this error in the following line of my code.

    PGPObjectFactory factory=new PGPObjectFactory(PGPUtil.getDecoderStream(is));
    =>> Object obj=factory.nextObject();//here i am getting obj as null
    if (obj == null)
    {
    //System.out.println("Invalid PGP Message");
    //System.exit(0);
    throw new IllegalArgumentException("Invalid PGP message");

    }
    if (obj instanceof PGPEncryptedDataList) {
    return (PGPEncryptedDataList)obj;
    }
    else {
    return (PGPEncryptedDataList)factory.nextObject();
    }
    Plz help any one...aspl

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: Exception in PGP Decryption

    Do you have any doc for the packages and classes you are using? What does it say?

    Please edit your post and wrap your code with code tags:
    [code]
    YOUR CODE GOES HERE
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Exception in PGP Decryption
    By Hemajoshi in forum Advanced Java
    Replies: 1
    Last Post: 06-06-2013, 07:35 PM
  2. Need some help with encryption decryption
    By JP34 in forum New To Java
    Replies: 1
    Last Post: 11-06-2012, 04:29 AM
  3. decryption equal to c#
    By alexalex in forum Advanced Java
    Replies: 1
    Last Post: 10-29-2012, 01:13 PM
  4. Exception in PGP Decryption/Java
    By Triveni in forum New To Java
    Replies: 0
    Last Post: 07-23-2012, 09:12 AM
  5. Re: Exception in PGP Decryption
    By Deepa in forum New To Java
    Replies: 27
    Last Post: 07-18-2012, 05:16 AM

Posting Permissions

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