Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > BOOK: Beginning Cryptography with Java
BOOK: Beginning Cryptography with Java
This is the forum to discuss the Wrox book Beginning Cryptography with Java by David Hook; ISBN: 9780764596339
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Cryptography with Java section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 25th, 2006, 03:19 PM
Registered User
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default working with certification requests

I'm building a mini-CA. I'm trying to accept the PEM-respresentation of a user's certification request (which was made from keytool), and use it to generate a certificate. However, when I try to instantiate a PKCS10CertificationRequest using the byte array constructor (the byte array comes from reading the certification request into an array of bytes), I get the following error:

Exception in thread "main" java.lang.IllegalArgumentException: badly encoded request
    at org.bouncycastle.jce.PKCS10CertificationRequest.to DERSequence(Unknown Source)
    at org.bouncycastle.jce.PKCS10CertificationRequest.<i nit>(Unknown Source)

Any suggestions on how to get beyond this? I need the mini-CA to accept PEM-encoded certification requests created separately by an end user whether by copy & paste into a textbox or file upload or whatnot. I do not want to use Bouncy Castle to create the initial certification request.
Old November 25th, 2006, 05:50 PM
dgh dgh is offline
Wrox Author
Join Date: Aug 2005
Posts: 206
Thanks: 0
Thanked 20 Times in 20 Posts

Are you base64 decoding the byte array before passing it in? The constructor expects to receive an ASN.1 encoded array.

If you are using PEM you might also want to look at the classes in the package org.bouncycastle.openssl



Old November 25th, 2006, 09:36 PM
Registered User
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks for your quick reply. I had been doing the base64 decoding, but I had also forgotten to strip out the first and last ascii header and footer lines. Now it works much better.

Similar Threads
Thread Thread Starter Forum Replies Last Post
New Forums requests toma Forum and Wrox.com Feedback 2 August 22nd, 2007 03:10 PM
Multiple Concurrent Requests to XmlHttpRequest deepak.vasudevan Ajax 3 March 22nd, 2006 04:56 AM
Multiple Concurrent Requests to XmlHttpRequest deepak.vasudevan Javascript 0 November 14th, 2005 06:49 AM
My Thanks and Requests!!! mehdi62b Forum and Wrox.com Feedback 0 September 3rd, 2004 04:50 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.