Problem with creating a third party signed x509 certificate

Dear all
I'm working on pki project, in which i need to generate a key pair and and using it to create a self-signed x509 certificate, it will act as the CA and using it private key to sign all other x509 certificate, I have no problem on creating the self-signed cert, but when try to create other cert using CA private, I got the following exception
Caught exception: java.security.InvalidKeyException: Public key presented not for certificate signature
I'm using bouncycastle to do the cert generation, here is an example of my code
   Security.addProvider(new BouncyCastleProvider());
   //be sign key pair
   KeyPairGenerator keyGen=KeyPairGenerator.getInstance("DSA");
   keyGen.initialize(1024, new SecureRandom());
   KeyPair keypair=keyGen.generateKeyPair();
   PrivateKey prikey=keypair.getPrivate();
   PublicKey pubkey=keypair.getPublic();
   //ca key pair
   KeyPair cakeypair=keyGen.generateKeyPair();
   PrivateKey caprikey=cakeypair.getPrivate();
   PublicKey capubkey=cakeypair.getPublic();
   Hashtable attrs = new Hashtable();
   attrs.put(X509Principal.CN, "Test");
   //generate cert
   X509V3CertificateGenerator certGen=new X509V3CertificateGenerator();
   certGen.setSerialNumber(BigInteger.valueOf(1));
   certGen.setIssuerDN(new X509Principal(attrs ));
   certGen.setNotBefore(new Date(System.currentTimeMillis() - 50000));
   certGen.setNotAfter(new Date(System.currentTimeMillis() + 50000));
   certGen.setSubjectDN(new X509Principal(attrs));
   certGen.setPublicKey(pubkey);
   //certGen.setSignatureAlgorithm("MD5WithDSAEncryption");
   certGen.setSignatureAlgorithm("SHA1withDSA");
   X509Certificate cert=certGen.generateX509Certificate(caprikey);
   cert.checkValidity(new Date());
   cert.verify(pubkey);
   Set dummySet=cert.getNonCriticalExtensionOIDs();
   dummySet=cert.getNonCriticalExtensionOIDs();I have no idea what problem is
I hope that bouncycastle supporter or anyone could help me or give some guidance and I'm much appreciate that.

Hi tkfi
your problem is you'er not using the ca public key to do the verification, replace the
cert.verify(pubkey);
to
cert.verify(capubkey);
and it should be work

Similar Messages

  • 2.3 Update:  Problem with AppleTV learning third-party remote

    Hello,
    I'm trying to set up my third party remote (DirecTV HR21) after updating to 2.3. It all starts well; I go to Settings -> General -> Remotes -> Learn Remote, but I am having an issue when I am making my Apple TV learn the second key (down arrow); I get the error message "apple tv has already learned this button". It's as if the Apple TV thinks the 'up arrow' and the 'down arrow' on my remote are the same key. I tried several times, to no avail.
    Anyone else having this issue?

    I'm experiencing the same problem with the current DirecTV remote not being able to learn more than the first button prompted to enter (arrow-down). The error message "appletv has already learned this button" appears when attempting to enter the second button prompted (arrow-up). Furthermore, I have attempted configuration on two separate DirecTV HR21 remotes in both AV1 and AV2 modes.
    Come on Apple -- don't tease us! Testing wasn't done to make sure AppleTV can learn to respond to a current DirecTV remote? Yikes. I wonder what 3rd-party remotes were tested and confirmed to work.

  • What are the restrictions/limitation in lookout with the use of graphs created in third party software? When we use these kind of graphs we normally loose resolution, shadows or 3D effects.

    We don't know exactly how does lookout handle .bmp or .wmf files created in third party programs like CorelDraw, since we have a different response from lookout to those graphs. We loose the shadows effects, we don't have a transparect effect, etc.
    Thanks in advance, any help is welcome.

    It shows Peter's doing its jobs properly.
    Anyway there is no more communication from Sony since awihle. If you can have any news.
    Anyway good job Zero!

  • I am having problems with creating my apple id. On the phone it is advising me that the ID is not created and then when i do it online it says that it has been created. Can you advise me on what to do please?

    I am having problems with creating my apple id. On the phone it is advising me that the ID is not created and then when i do it online it says that it has been created. Can you advise me on what to do please?

    Apple ID FAQ   http://support.apple.com/kb/HE37

  • IC WebClient Connectivity with ICI and Third Party Solution (Genesys)

    <b>Hi Techies,
                 Can any body give the information about the IC WebClient Connectivity with ICI and Third Party Solution (Especially Chat and Mail Configuration with Web Client in CRM). We are using CRM 5.0 server with Java+Abap Engine.  I need configuration for Web Client Genesys(Third Party) with ICI configuration.  I dont have idea regarding this. I 've little idea on Business Communication Broker.  Can any help me out in this regard.   Thanks in an advance. If u have any document it can be acceptable.
    Regds,</b>
    Govinda
    [email protected]

    We are looking for a site to site model. I want all the devices on the remote network to be on their own subnet. We need to be able to hit individual remote devices from the head end. The devices at the remote site in turn also need to be able to communicate with each other without having to use the VPN.

  • Problem with create universe on Business Objects XI 3.1 base on SAP Query

    Hello,
    I have a problem with create universe on Business Objects XI 3.1 base on SAP Query.
    The problem is hierarchy. Massage on Busines Objects is :
       OWBS_ELEMT__ISTKOSZT(cube ICPC01/BEX_ICOC01):Exception condition  "HIERARCHY NOT FOUND" raised.(WIS 10901) 
    Query in BEX run OK.
    Best regards.
    Ela.

    Hello,
    Thanks for response.
    When I run BEX QUERY, all works OK.
    All hierarchies was created and activated  on system BW.
    This situation appears after upgrade BW to SAP NetWeaver 7.3.
    Before upgrade I created universe without any problems.
    Regards Ela

  • Problem with creating new user in portal = portlet is not visible

    Hi,
    I've got a problem with creating new users in portal. In the Administer tab of the builder is the user portlet not visible.
    How can I make this portlet visible?
    Please Help
    thank you...
    Gilbert

    Hi..my problem slightly similar.
    I created one new user, and didn't select anything from "Public Groups Assignment" and "Privilege Assignment" for him.
    I expect the user will be a public user.
    But, when he try to logged in the portal,
    He cannot see all the PORTLETS related to database values..
    All he can see just LINKS -that all in my portal right now beside the report from database that the user cannot see :)
    So, what did i do wrong?
    Plz Advise, and thanks.

  • Problem with creating site from another computer!

    Hi
    I have WebDB 2.2 and Oracle8i instaled on the same computer. I have a problem to create site from another computer. There is not any process when I try to create site. There is always 0%.
    But I have no problem with creating site on the origin computer.
    Does anybody know something about it?

    I am just not clear what to do once I have made changes and have published the new information.
    You shouldn't have to do anything. iWeb will save the information in the Domain.sites file. You can keep this file in a folder, or even on your desktop and iWeb will launch from a double-click on the file.

  • Problem with creating email account on E72

    I have bought E72 and want to use mine company email - but there is a problem with creating email account in mail program.
    Restoring to fabric settings doesn't works.
    When I'm creating Gmail account it's OK, but phone doesnt want to cooperate with other accouns:/

    Try again without using WLAN. I had same problem, but solved it using GPRS.

  • Problem with creating chapter-markers

    Hi everyone,
    as the title already says it, I've got a problem with creating chapter markers in Quicktime Pro 7.6.4. There's something wrong with the font, displayed in Quicktime. The problem first appeared a few days ago. Before this, everything went fine and I don't have a clue what causes the problem.
    Please click HERE to see a screen-recording of the steps I do to create chapters:
    - convert the chapters into unformatted text and save it as Unicode (UTF-16) text file.
    - open it in Quicktime and everything (including the german umlauts) is displayed correct.
    - export it into a Text-file with description
    when I open the new text file in Quicktime, the fonts are displayed in asian letters, but when I view it in the Texteditor, the text is almost correct, BUT the umlauts are not ok. So I go on with...
    - correct the umlauts and save a new file as Unicode (UTF-16) again.
    After I open the new file in Quicktime, the text is completely gone. As the text file seems to be ok in the Texteditor, I guess there must be something wrong with Quicktime. I tried to reinstall Quicktime 7 from the "Mac OS X 10.6 Snow Leopard" Installation-Disc, but the problem persists.
    I' would appreciate any help...
    Thanks in advance and best regards,
    Michael

    I'm having the exact same issue. I have created my movie in IMovie 09 then under the "share " menu I sent the movie to iDVD. Everything looks fine on screen, but all I get on the final product is the movie.
    After digging deeper into the tutorials all they show is dragging a movie into the idvd shell, not sharing via imovie.
    Thus I'm currently attempting to create a quicktime movie then drag it into the IDVD shell. I think that way the chapter markers and everything should show up and burnt into the final project. I'm guessing the "share" option with the IDVD from iMovie doesn't work properly???

  • Problem with creating order through order template

    Hi experts,
    We have problem with creating order by order template.  Extensions data available in order template is not sent to order.   Extension data are showing upto order submission form.  But after sucessful creation of order  extension data are no longer available in  CRM-ORDEr.
    We are using ISA 4.0 with CRM 4.0.
    We recently applied patches on CRM server.  Before patching it was working fine.
    Can you please suggest us to solve this issue?
    Thanks in Advance.
    Regards,
    Murugan Arumugam.

    closed.

  • Problem with  Creating Info Record

    Hello Gurus,
    I've problem with Creating Info Record
    i tried to create info record for Plant Specific/Purchase Org
    The first Screen General Data is OK
    i entered all the data in the next screen ie
    Purchase Organization Data screen but i'm getting error
    <b>Make an entry in all required fields</b>
    but there is Mandatory Textbox ie "VALID TO" which im unable to select Bcos its Disabled
    pls help me regarding this
    thanks in advance

    Hi
    Have u given the net price. <b>VALID TO</b> is the date until which the price shown in the info record is valid.
    If there is no price that is valid on the current date, the last-valid price is displayed and the date field contains the day before the start of the next validity period (this may be 12.31.9999 if there is no further validity date). If all validit periods lie beyond the current date, the price of the next period is displayed. The date field then contains the end date of this period.
    These validity periods we will maintain Purchse data CONDITIONS while creating info record. Check the validity period for the conditions.
    Hope this will helps u
    Ravi
    Ravikumar Bolla

  • Problem with creating virtual column

    Hello,
    We've got problem with creating virtual column.
    There is table R_T that contain columns R_ID and L_ID, we would like to create virtual column RL_ID that contains sth like 'R_ID-L_ID' (R_ID, L_ID and RL_ID are varchars).
    According documentation we've tried:
    alter table R_T add column (RL_ID varchar2(60) generated always as (R_ID||'-'||L_ID) VIRTUAL)
    but getting
    ORA-00904: : invalid identifier
    00904.00000 - "%s: invalid identifier"
    Have no idea where is the problem.
    Table, columns names are little different but contains only capital letters A - Z and underscore "_".
    Has anyone idea?
    Thanks a lot.

    Strange...
    This does work for me :
    Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
    Connected as dev
    SQL>
    SQL> create table r_t (
      2   r_id varchar2(25),
      3   l_id varchar2(25)
      4  );
    Table created
    SQL> insert into r_t (r_id, l_id) values('R','L');
    1 row inserted
    SQL> alter table r_t add (rl_id varchar2(60) generated always as (r_id||'-'||l_id) virtual);
    Table altered
    SQL> select * from r_t;
    R_ID                      L_ID                      RL_ID
    R                         L                         R-L
    SQL>

  • I have problems with creating new projects in iMovie.

    I have problems with creating new projects. When i try, the mac says the following "Make sure there is enough disk space and that you have permission to write the projects to the drive." I have 8GB available, so its not that.

    thanks for your support
    lol

  • Please do not laugh:( I have a problem with creating i Cloud account. When I download i Cloud and am supposed to sign it uo, I get a message that my This Apple ID is valid, but is not an i Cloud account.

    Not everybody are advanced in use of different devices. I have problems with everything, now trying to move my I tunes to my ny PC. I reccon it would be easiest by using i Cloud. But I am even not able to create an account.
    Can somebody help?

    stf10 wrote:
    ... trying to move my I tunes to my ny PC. ...
    From where are you trying to move your iTunes...

Maybe you are looking for