How to create a V3 signature msg using BouncyCastle OpenPGP

Our Unix PGP v2.x created a signed and encrypted message with the following sequence of packets::
encrypted data packet:
length: 342
gpg: encrypted with 2048-bit RSA key, ID 630C97A1, created 2006-05-25"
rcashxsign <[email protected]>"
gpg: IDEA encrypted data
:compressed packet: algo=1, keyid BC19C7E5630C97A1
version 3, created 1168632782, md5len 5, sigclass 00
digest algo 1, begin of digest 4f 7e
data: [2047 bits]
:literal data packet:
mode b (62), created 0, name="testyong",
raw data: 29 bytes
gpg: WARNING: message was not integrity protected
Looking at the signature part, you see there is no one-pass signature packet, the signature is before the literal data.
The test method generateV3BinarySig() in \src\org\bouncycastle\openpgp\test\PGPSignatureTest.java obviously does a different job.
Does anyone know how to create such a PGP v2.x signature message?
We are close to product release. I greatly appreciate your help

It turns out I put the following literal packet generation code before the signature packet generation code:
//Then output the literature data
  PGPLiteralDataGenerator lGen = new PGPLiteralDataGenerator(true);
  OutputStream lOut = lGen.open(bcOut, PGPLiteralData.BINARY, file);   
  lOut.write(bOut.toByteArray());They should be put after the signature packet generation code because the lGen.open(...) actually writes out the literal data packet header.
Here is the sample code to make a PGP 2.x signature (or version 3 signature):
//Compress data
      PGPCompressedDataGenerator cGen = new PGPCompressedDataGenerator(CompressionAlgorithmTags.ZIP);
      BCPGOutputStream bcOut = new BCPGOutputStream(cGen.open(out));
      File file = new File(inFileName);
      FileInputStream fIn = new FileInputStream(file);
      int ch = 0;
      ByteArrayOutputStream bOut = new ByteArrayOutputStream();
      while ((ch = fIn.read()) >= 0) {
        bOut.write(ch);
        sGen.update((byte) ch);
      //First output the signature
      sGen.generate().encode(bcOut);
      //Then output the literature data
      PGPLiteralDataGenerator lGen = new PGPLiteralDataGenerator(true);
      OutputStream lOut = lGen.open(bcOut, PGPLiteralData.BINARY, file);
      lOut.write(bOut.toByteArray());
      lGen.close(); 
      cGen.close();

Similar Messages

  • How to create a digital signature using mac

    C
    an someone tell me how to create a digital signature I can use to sign documents with?

    Launch the Preview application and search its built-in help for the term "signature."

  • How can i make a signature by using lightroom? , is it possible?

    how can i make a signature by using lightroom? , is it possible?

    To can create a text identity plate in LR but to create a graphical version
    requires Photoshop

  • How to create a digital signature in adobe reader

    how to create a digital signature in adobe reader?

    Adobe Reader Touch (Windows Store app with "modern" UI) does not support any types of signatures yet.
    Digital Signatures with certificates
    Electronic Signatures (that are legally enforceable)
    Signature annotations (hand-writing annotations which may not be secure and legally enforceable)
    Adobe Reader XI (traditional desktop app with classic UI) supports #1 and #3.
    Adobe EchoSign supports #2.
    Adobe Reader for iOS/Android supports #3.

  • How to create a stored procedure and use it in Crystal reports

    Hi All,
    Can anyone explain me how to create a stored procedure and use that stored procedure in Crystal reports. As I have few doubts in this process, It would be great if you can explain me with a small stored proc example.
    Thanks in advance.

    If you are using MSSQL SERVER then try creating a stored procedure like this
    create proc Name
    select * from Table
    by executing this in sql query analyzer will create a stored procedure that returns all the data from Table
    here is the syntax to create SP
    Syntax
    CREATE PROC [ EDURE ] procedure_name [ ; number ]
        [ { @parameter data_type }
            [ VARYING ] [ = default ] [ OUTPUT ]
        ] [ ,...n ]
    [ WITH
        { RECOMPILE | ENCRYPTION | RECOMPILE , ENCRYPTION } ]
    [ FOR REPLICATION ]
    AS sql_statement [ ...n ]
    Now Create new report and create new connection to your database and select stored procedure and add it to the report that shows all the columns and you can place the required fields in the report and refresh the report.
    Regards,
    Raghavendra
    Edited by: Raghavendra Gadhamsetty on Jun 11, 2009 1:45 AM

  • How to create ringingtone into my iPhone using macbook?

    pls teach me how to create ringingtone into my iphone using macbook...

    Have you installed iOS 5 on your iPhone 3GS?
    If not - then connect it to iTunes, and prepare yourself for a very big download!
    It will give step by step instructions once iOS 5 is installed.
    Cheers,
    Rodney

  • How to create an RDBMS event generator using wlst on weblogic 10.3

    how to create an RDBMS event generator using wlst on weblogic 10.3, i got a code fragment needing class "com.bea.wli.management.configuration.RDBMSEventGenChannelConfiguration"
    but i can' t find this class in classpath on weblogic 10.3, pls help me, thanks. code sample is better.

    Hi,
    RDBMS Event Generator Channel Rule Definition
    When you are creating channel rule definitions in the WebLogic Integration Administration Console, it is recommended that you do not use the Back button if you want to resubmit the details on a page.
    You should always use the navigation links provided and create a new channel rule definition.
    http://download.oracle.com/docs/cd/E13214_01/wli/docs85/deploy/cluster.html
    http://download.oracle.com/docs/cd/E13214_01/wli/docs81/relnotes/relnotesLimit.html
    http://otndnld.oracle.co.jp/document/products/owli/docs10gr3/pdf/deploy.pdf
    This problem has been seen in the past when defining the channel rule for an RDBMS Event Generator if schema name was specified with the incorrect case (i.e. lowercase when it should have been uppercase or vice versa). To that end, it is suggested to change the case of the schema when creating the channel rule
    Regards,
    Kal

  • How to create an apple id without using credit card

    how to create an apple id without using credit card.. i have recently purchased apple iphone 3gs bt unable to get apps because of giving credit card info which i dnt hav.. so plz tel me some way to process..

    To get the none option, sign out of anything apple you're signed into. Go to the app store and try to download a free app, any free app. Instead of signing in, take the option to to make a new apple ID. Then go through the steps to make the ID and you'll see the 'none' option.

  • How to create search function (af:query) using method in java

    hi All..:)
    i got problem with search custom (af:query), how to create search function/ af:query using method in java class?
    anyone help me....
    thx
    agungdmt

    Hi,
    download the ADF Faces component demo sources from here: http://www.oracle.com/technetwork/testcontent/adf-faces-rc-demo-083799.html It also has an example for creating a custom af:query model
    Frank

  • How to create autofilter in excel page using jxl api?

    Hi Friends,
    I am using jxl api for excel generation. Its no problem
    but i need to set auto filter options. I am search in this API package but i can't find it.
    Any one know how to create autofilter in excel page using jxl api?.
    Please ..... Its urgent.... ...
    Thanks

    Hi,
    Please mail me on [email protected] if u will find any solutions, i will do the same if i will find any...
    Thank u in advance,

  • How to create  Auto suggestion component by using of ADF tag

    Hi ,
    In my project, I am using the ADF frame work and I need to use the auto suggestion component.
    Can any body suggest me how to create Auto suggestion component by using of ADF tag.
    Waiting for your valuable suggestions...

    Try this forum:
    JDeveloper and ADF
    You might get a lot more response.
    Jan Kettenis

  • How to create  hierarchy on bi7 by using dtp

    how to create  hierarchy on bi7 by using dtp

    Hi Deba,
    Procedure to create Hierarchies:
    1.      In the Data Warehousing Workbench under Modeling, choose the InfoObject tree.
    2.      If you have assigned the hierarchy basic characteristic to an InfoObject catalog, select the corresponding InfoObject catalog for an InfoArea.
    If the hierarchy basic characteristic does not belong to an InfoObject catalog, choose the InfoArea Non-Assigned Nodes and the InfoObject Catalog Non-Assigned Characteristics.
    3.      Select the characteristic for which you want to create a hierarchy and choose Create Hierarchy from the context menu. The Create Hierarchy dialog box appears. The InfoObject name appears by default.
    4.      Enter a hierarchy name and description (short, medium, long). Other fields may be displayed, depending on which hierarchy properties were selected for the hierarchy basic characteristics
    Fields used to enter the Validity (valid to, valid from) for the hierarchy property Total Hierarchy Time-Dependent
    Fields used to specify the Hierarchy Version for the hierarchy property Hierarchies Version-Dependent.
    5.      Confirm your entries. The Maintain Hierarchy screen appears. You can define the structure of a hierarchy here.
    6.      To create a hierarchy node, you first need to choose an insertion mode:  Insert as First Child or   Insert As Next Neighbor (see Hierarchy Editing Functions).
    7.      Choose the type of node you want to create: Text Node, Characteristic Node, <Hierarchy Basic Characteristic Node> or Interval (see Hierarchy Nodes)
    8.      Repeat this procedure until the hierarchy structure has been set. For more information, see Modeling Nodes and Leaves.
    A hierarchy can contain 50,000-100,000 leaves at most. If your hierarchy is larger, you should insert a level that is used as a navigation attribute or preferably as a separate characteristic in the dimension table.
    9.      You can use Level Maintenance and Hierarchy Attributes to set how the hierarchy is to be displayed and processed in reporting (see Level Maintenance and Hierarchy Attributes).
    10.      Save the hierarchy.
    11.      Activate the hierarchy. See Editing Hierarchies.
    For more info
    [http://help.sap.com/saphelp_nw70/helpdata/EN/80/1a6736e07211d2acb80000e829fbfe/content.htm]
    [http://help.sap.com/saphelp_nw70/helpdata/EN/e6/951d102a6c11d5b2e40050da4c74dc/content.htm]
    Regards,
    Rajkandula

  • How to create Profit and loss account using report painter

    Dear All,
    Can some one guide me as to how to create Profit and loss account using report painter.
    If some one can share the document having steps to be done,would be of great help.
    Thanks in advance.
    Regards,
    Gokul

    Hi,
    Could you please re-phrase your question? As the report painter is a reporting tool I assume you want to report on P&L accounts and not u201Ccreateu201D them. A few more details on what you intend to report would be useful.
    Regards
    Karl

  • How to create chord charts from midi using logic pro x

    How to create chord charts from midi using logic pro x

    Depending on what you mean by Chord charts (Tabs?)
    Use the Score.......
    http://help.apple.com/logicpro/mac/10/#lgcpf755d649

  • How to create 3d photgallery in flex using xml

    How to create 3d photgallery in flex using xml . I am new to flex please help me.Thanks in advance

    How to create 3d photgallery in flex using xml . I am new to flex please help me.Thanks in advance

Maybe you are looking for