Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Posts: 101
Registered: ‎05-11-2009
My Device: 9000

Custom Key signing doesn't work

[ Edited ]



I am making my own library, and I have created my own custom key signing with  "Private key administration" and "Remote key administration".


The .csi file was created, and now I am trying to install it with Eclipse. 


I have created a Java Servlet proxy as it is writing in This article, using Apache Tomcat 6.0 I can see that it is working if I access it through the browser (it just returns blank page) right now it is located on my local machine only.


However when I am trying to register it, it always gives me "Server unavailable at this time. Please contact your system administrator" 


I don't know what I am doing wrong or where should I look for more information, please help. 


P.S. I have tried debuggin servlet, and it is interesting that "Signature tool registration" never sends a request for some reason. If I type my address in browser then I can see it reaches, but with this "Signature tool registration" it doesn't, for some unknown reason. 




P.S.S Or atleast can some one explain exactly what is going on and how this proxy actually work. The comments in the source code are misleading for example It says "The service method is invoked for both GET and POST", however it checks and allows only POST requests !

The same way, what does URL m_webSignerServer do ? it is always null, so no response would be sent. 
Here is the code from servlet example:

public class WebSignerProxyServlet extends HttpServlet { protected URL m_webSignerServer; /** * JRun invokes the service method whenever the servlet is requested * by a client. The service method is invoked for both GET and POST * requests. Alternatively, you could place this code in the doGet and * doPost methods. */ public void service( HttpServletRequest request, HttpServletResponse response ) throws IOException { try { String method = request.getMethod(); if (method.equalsIgnoreCase("POST") && m_webSignerServer != null) { InputStream fromClient = request.getInputStream(); // Read the properties file in. Properties propertiesIn = new Properties(); propertiesIn.load( fromClient ); // Write out the property file that was read in. ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream(); propertiesIn.setProperty("IPAddress", request.getRemoteAddr()); propertiesIn.store( byteArrayStream, "CSC File according to the specs for the Signature Tool." ); byte[] encodedPropertyTable = byteArrayStream.toByteArray(); URLConnection urlConnect = m_webSignerServer.openConnection(); if (urlConnect == null || !(urlConnect instanceof HttpURLConnection)) { throw new IOException(); } HttpURLConnection toServer = (HttpURLConnection)urlConnect; // Post the message to the server. toServer.setRequestMethod("POST"); toServer.setUseCaches(false); toServer.setDoInput(true); toServer.setDoOutput(true); OutputStream os = toServer.getOutputStream(); os.write(encodedPropertyTable); os.flush(); // Read the properties file in. Properties propertiesOut = new Properties(); propertiesOut.load( toServer.getInputStream() ); toServer.disconnect(); // Write the response. response.reset(); ServletOutputStream toClient = response.getOutputStream(); byteArrayStream = new ByteArrayOutputStream(); propertiesOut.store( byteArrayStream, "CSC File according to the specs for the Signature Tool." ); encodedPropertyTable = byteArrayStream.toByteArray(); toClient.write(encodedPropertyTable); response.flushBuffer(); } } catch (Throwable e) { // Attempt to write a response to the client. Properties properties = new Properties(); properties.setProperty("Version", "0"); properties.setProperty("Error", "Error connecting to File Signer from proxy"); response.reset(); ServletOutputStream toClient = response.getOutputStream(); ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream(); properties.store( byteArrayStream, "CSC File according to the specs for the Signature Tool." ); byte[] encodedPropertyTable = byteArrayStream.toByteArray(); toClient.write(encodedPropertyTable); response.flushBuffer(); } } public String getServletInfo() { return this.getClass().getName(); } }


Message Edited by DMINATOR on 06-15-2009 04:46 PM
BlackBerry Development Advisor
Posts: 15,302
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: Custom Key signing doesn't work

Was the correct URL for your proxy configured in the Signing Authority Admin tool before you issued your key?  If you open the .csi file in a text editor it'll show the URL it will communicate through.  Is this valid?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker