Java Doc for AppDescriptor.java in  » 6.0-JDK-Modules » j2me » com » sun » midp » jadtool » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » com.sun.midp.jadtool 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.util.Hashtable
      java.util.Properties
         com.sun.midp.installer.JadProperties
            com.sun.midp.jadtool.AppDescriptor

AppDescriptor
public class AppDescriptor extends JadProperties (Code)
Java API for signing MIDletSuites.

AppDescriptor is an extension of the Properties class which provides additional methods for adding message digest and certificate properties as well as signing the app descriptor file and verifying a signed app descriptor file.



Field Summary
public static  intCERT
     Index of the cert in arrays returned by getAllCerts.
final public static  StringCP_ATTR
     App Descriptor key for .
final public static  StringJAR_SIGNATURE
     App Descriptor key for .
final public static  StringJAR_SIZE
     App Descriptor key for .
final public static  StringJAR_URL
     App Descriptor key for .
public static  intKEY
     Index of the key in arrays returned by getAllCerts.
final public static  StringSEP_ATTR
     App Descriptor key for .
final public static  StringSIGN_ALG
     SHA1 with RSA constant.

Constructor Summary
public  AppDescriptor()
    

Method Summary
public  voidaddCert(String alias, int chainNum, int certNum)
     Retrieves a certificate out of a KeyStore and adds it to the app descriptor as:

content_provider.certificate-1-1:

Instance variable keystore must not be null, and should have been set by loadKeyStore before this method is called.

public  voidaddJarSignature(String alias, char[] keypass)
     Adds a Base64 encoded signature of the jar file at the URL specified by the MIDlet-Jar-URL key in the app descriptor. load and loadKeyStore must be call before this method.

The line in the app descriptor corresponding to this insertion will look like this:

MIDlet-Jar-RSA-SHA1:j3zKCv6eud2Ubkw80XjpNb7tk5s... If a MIDlet-Jar-RSA-SHA1 property already exists it will be replaced.
Parameters:
  alias - Alias of the signing key in the keystore.
Parameters:
  keypass - Password to access the signing (private) key.
exception:
  AppDescriptorException - JAR URL or content providercertificate wasnot found in the app descriptor.
exception:
  MalformedURLException - The URL corresponding to the MIDlet-Jar-URL key could not be parsed.
exception:
  IOException - error reading the JAR
exception:
  NoSuchAlgorithmException - If SHA1 or RSA need bygetEncodedSig could not be found in aninstalled JCA provider.

public  voidaddJarSignature(String alias, char[] keypass, InputStream jarStream)
     Adds a Base64 encoded signature of the jar file provided in an input stream to the app descriptor.

The line in the app descriptor corresponding to this insertion will look like this: MIDlet-Jar-RSA-SHA1:j3zKCv6eud2Ubkw80XjpNb7tk5s... If a MIDlet-Jar-RSA-SHA1 property already exists it will be replaced.
Parameters:
  alias - Alias of the signing key in the keystore.
Parameters:
  keypass - Password to access the signing (private) key.
Parameters:
  jarStream - stream to read the jar file from
exception:
  IOException - If there is a problem reading the input stream.
exception:
  NoSuchAlgorithmException - If SHA1 or RSA need bygetEncodedSig could not be found in aninstalled JCA provider.

static  StringcreateFingerprint(byte[] certificateBytes, String algorithm)
     createFingerprint - A helper function used by getdigest. createFingerprint, given a certificated encoded as a byte array will compute a "fingerprint", or Message Digest of the certificate using the selected algorithm type. A fingerprint is meant to be human readable, and is thus returned as a hex string separated at byte boundaries by a delimiter ":".
Parameters:
  certificateBytes - - a certificate encoded as a byte array
Parameters:
  algorithm - - The name of a digest algorithm to use, e.g.
public  VectorgetAllCerts()
     Returns all X509Certificate objects from the app descriptor.
public  X509CertificategetCert(int chainNum, int certNum)
     Returns an X509Certificate object from the app descriptor property chosen by certnum, or null if that certificate does not exist in the descriptor.
public  X509CertificategetCertAttribute(int chainNum, int certNum)
     Returns an X509Certificate object from the app descriptor property chosen by certnum, or null if that certificate does not exist in the descriptor.
public  StringgetCertDigest(int chainNum, int certNum, String alg)
     Returns a message digest of a certificate in "human readable" from from the app descriptor property chosen by certnum, or null if that certificate does not exist in the descriptor.

After finding the chosen property in the app descriptor, decodes it from Base64 into a byte-encoded certificate and then creates a readable digest String based on that data.
Parameters:
  chainNum - number of the certificate chain
Parameters:
  certNum - number of the certificate in the chain
Parameters:
  alg - A Digest algorithm to use, e.g.

public synchronized  voidload(InputStream inputJad, String encoding)
     Used to input a stored app descriptor into an AppDescriptor instance from a stream.
public synchronized  voidloadKeyStore(InputStream ksfile, char[] storepass)
     Provides a KeyStore instance for use by this AppDescriptor object.
public synchronized  voidstore(OutputStream outputJad, String encoding)
     Used to store an app descriptor instance into a jad file through an output stream.
public synchronized  voidstoreKeyStore(String ksfname, char[] storepass)
     Store a the keystore in the descriptor in a file.

Field Detail
CERT
public static int CERT(Code)
Index of the cert in arrays returned by getAllCerts.



CP_ATTR
final public static String CP_ATTR(Code)
App Descriptor key for .



JAR_SIGNATURE
final public static String JAR_SIGNATURE(Code)
App Descriptor key for .



JAR_SIZE
final public static String JAR_SIZE(Code)
App Descriptor key for .



JAR_URL
final public static String JAR_URL(Code)
App Descriptor key for .



KEY
public static int KEY(Code)
Index of the key in arrays returned by getAllCerts.



SEP_ATTR
final public static String SEP_ATTR(Code)
App Descriptor key for .



SIGN_ALG
final public static String SIGN_ALG(Code)
SHA1 with RSA constant.




Constructor Detail
AppDescriptor
public AppDescriptor()(Code)
Default constructor




Method Detail
addCert
public void addCert(String alias, int chainNum, int certNum) throws CertificateException, KeyStoreException, AppDescriptorException(Code)
Retrieves a certificate out of a KeyStore and adds it to the app descriptor as:

content_provider.certificate-1-1:

Instance variable keystore must not be null, and should have been set by loadKeyStore before this method is called.
Parameters:
  alias - Alias of the chosen certificate in the keystore
Parameters:
  chainNum - number of the chain to add certificate to
Parameters:
  certNum - number of the certificate in the chain to replace it,or 0 to add the certificate at the end of the chain
exception:
  KeyStoreException - If there is an error with the keystore.
exception:
  CertificateException - If there is a problem with theencoding of the certificate.
exception:
  AppDescriptorException - If the KeyStore has not been initialized (keystore is null)




addJarSignature
public void addJarSignature(String alias, char[] keypass) throws AppDescriptorException, MalformedURLException, IOException, KeyStoreException, InvalidKeyException, SignatureException, NoSuchAlgorithmException, UnrecoverableKeyException(Code)
Adds a Base64 encoded signature of the jar file at the URL specified by the MIDlet-Jar-URL key in the app descriptor. load and loadKeyStore must be call before this method.

The line in the app descriptor corresponding to this insertion will look like this:

MIDlet-Jar-RSA-SHA1:j3zKCv6eud2Ubkw80XjpNb7tk5s... If a MIDlet-Jar-RSA-SHA1 property already exists it will be replaced.
Parameters:
  alias - Alias of the signing key in the keystore.
Parameters:
  keypass - Password to access the signing (private) key.
exception:
  AppDescriptorException - JAR URL or content providercertificate wasnot found in the app descriptor.
exception:
  MalformedURLException - The URL corresponding to the MIDlet-Jar-URL key could not be parsed.
exception:
  IOException - error reading the JAR
exception:
  NoSuchAlgorithmException - If SHA1 or RSA need bygetEncodedSig could not be found in aninstalled JCA provider.
exception:
  KeyStoreException -
exception:
  InvalidKeyException -
exception:
  SignatureException -
exception:
  UnrecoverableKeyException -




addJarSignature
public void addJarSignature(String alias, char[] keypass, InputStream jarStream) throws IOException, NoSuchAlgorithmException, KeyStoreException, InvalidKeyException, SignatureException, NoSuchAlgorithmException, UnrecoverableKeyException(Code)
Adds a Base64 encoded signature of the jar file provided in an input stream to the app descriptor.

The line in the app descriptor corresponding to this insertion will look like this: MIDlet-Jar-RSA-SHA1:j3zKCv6eud2Ubkw80XjpNb7tk5s... If a MIDlet-Jar-RSA-SHA1 property already exists it will be replaced.
Parameters:
  alias - Alias of the signing key in the keystore.
Parameters:
  keypass - Password to access the signing (private) key.
Parameters:
  jarStream - stream to read the jar file from
exception:
  IOException - If there is a problem reading the input stream.
exception:
  NoSuchAlgorithmException - If SHA1 or RSA need bygetEncodedSig could not be found in aninstalled JCA provider.
exception:
  KeyStoreException -
exception:
  InvalidKeyException -
exception:
  SignatureException -
exception:
  UnrecoverableKeyException -




createFingerprint
static String createFingerprint(byte[] certificateBytes, String algorithm) throws NoSuchAlgorithmException(Code)
createFingerprint - A helper function used by getdigest. createFingerprint, given a certificated encoded as a byte array will compute a "fingerprint", or Message Digest of the certificate using the selected algorithm type. A fingerprint is meant to be human readable, and is thus returned as a hex string separated at byte boundaries by a delimiter ":".
Parameters:
  certificateBytes - - a certificate encoded as a byte array
Parameters:
  algorithm - - The name of a digest algorithm to use, e.g. "SHA1" or "MD5" the fingerprint in String form.
exception:
  NoSuchAlgorithmException - Thrown if the digestalgorithm could not be found.



getAllCerts
public Vector getAllCerts() throws CertificateException(Code)
Returns all X509Certificate objects from the app descriptor.

After finding a certificate property in the app descriptor, decodes it from Base64 into a byte-encoded certificate and then creates the X509 format certificate from that opaque data. Vector of object arrays, each containing key, and aX509Certificate object




getCert
public X509Certificate getCert(int chainNum, int certNum) throws CertificateException(Code)
Returns an X509Certificate object from the app descriptor property chosen by certnum, or null if that certificate does not exist in the descriptor.

After finding the chosen property in the app descriptor, decodes it from Base64 into a byte-encoded certificate and then creates the X509 format certificate from that opaque data.
Parameters:
  chainNum - number of the certificate chain
Parameters:
  certNum - number of the certificate in the chain an X509Certificate object or null if the certificate isnot in the JAD
exception:
  CertificateException - If there is a format problem withthe certificate




getCertAttribute
public X509Certificate getCertAttribute(int chainNum, int certNum) throws CertificateException(Code)
Returns an X509Certificate object from the app descriptor property chosen by certnum, or null if that certificate does not exist in the descriptor.

After finding the chosen property in the app descriptor, decodes it from Base64 into a byte-encoded certificate and then creates the X509 format certificate from that opaque data.
Parameters:
  chainNum - number of the certificate chain
Parameters:
  certNum - number of the certificate in the chain an X509Certificate object or null if the certificate isnot in the JAD
exception:
  CertificateException - If there is a format problem withthe certificate




getCertDigest
public String getCertDigest(int chainNum, int certNum, String alg) throws NoSuchAlgorithmException(Code)
Returns a message digest of a certificate in "human readable" from from the app descriptor property chosen by certnum, or null if that certificate does not exist in the descriptor.

After finding the chosen property in the app descriptor, decodes it from Base64 into a byte-encoded certificate and then creates a readable digest String based on that data.
Parameters:
  chainNum - number of the certificate chain
Parameters:
  certNum - number of the certificate in the chain
Parameters:
  alg - A Digest algorithm to use, e.g. "SHA1" or "MD5". A message digest of a certificate in hex as a String ornull if the certificate is not in the JAD.
exception:
  NoSuchAlgorithmException - Thrown if the digestalgorithm could not be found.




load
public synchronized void load(InputStream inputJad, String encoding) throws UnsupportedEncodingException, IOException, InvalidJadException(Code)
Used to input a stored app descriptor into an AppDescriptor instance from a stream. The input stream will be converted to Unicode using encoding if it is specified. If encoding is not specified, a default encoding of type "UTF8" escapes will be used. Overrides Properties.load
Parameters:
  inputJad - App descriptor input stream.
Parameters:
  encoding - Encoding of the inputJad stream.
exception:
  IOException - If an error occurs while loading the inputJad stream.
exception:
  UnsupportedEncodingException - If the given encodingtype is not supported.
exception:
  InvalidJadException - If the JAD has a format error



loadKeyStore
public synchronized void loadKeyStore(InputStream ksfile, char[] storepass) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, Exception(Code)
Provides a KeyStore instance for use by this AppDescriptor object. (The default KeyStore type from the Java security properties file is used. This should be type "JKS", and is the only supported keystore format.)

This KeyStore is required by the addcert, sign, signcert, and verify methods. If any of these methods is called before loadKeyStore an exception will be thrown.
Parameters:
  ksfile - The input stream stream to load a KeyStore from.
Parameters:
  storepass - The password to unlock the KeyStore, can be null.
exception:
  KeyStoreException - The default keystore provider typeis not available in any of the provider packages searched.
exception:
  IOException - Thrown if there is a problem parsing the input stream or loading its data.
exception:
  CertificateException - Thrown if there is trouble loadingcertificates into the KeyStore
exception:
  NoSuchAlgorithmException - Thrown if the algorithmneeded to verify the KeyStore cannot be found.




store
public synchronized void store(OutputStream outputJad, String encoding) throws UnsupportedEncodingException, IOException(Code)
Used to store an app descriptor instance into a jad file through an output stream. The internal Unicode stream will be converted to an output format using encoding if it is specified. If encoding is not specified, a default encoding of type Ascii with Unicode escapes will be used. Overrides Properties.store
Parameters:
  outputJad - App descriptor output stream.
Parameters:
  encoding - Encoding of the outputJad stream.
exception:
  IOException - If an error occurs while writing the inputJad stream.
exception:
  UnsupportedEncodingException - If the given encodingtype is not supported.



storeKeyStore
public synchronized void storeKeyStore(String ksfname, char[] storepass) throws IOException, KeyStoreException, NoSuchAlgorithmException, CertificateException(Code)
Store a the keystore in the descriptor in a file.
Parameters:
  ksfname - file to use
Parameters:
  storepass - password of keystore



Fields inherited from com.sun.midp.installer.JadProperties
final protected static int CR(Code)(Java Doc)
final protected static int EOF(Code)(Java Doc)
final protected static int HT(Code)(Java Doc)
final protected static int LF(Code)(Java Doc)
final protected static int SP(Code)(Java Doc)
protected char[] lineBuffer(Code)(Java Doc)

Methods inherited from com.sun.midp.installer.JadProperties
protected boolean checkKeyChars(String key)(Code)(Java Doc)
protected boolean checkValueChars(String value)(Code)(Java Doc)
public synchronized void load(InputStream inStream, String enc) throws IOException, InvalidJadException(Code)(Java Doc)
public synchronized void load(InputStream inStream) throws IOException, InvalidJadException(Code)(Java Doc)
public void partialLoad(InputStream inStream, String enc, int propertiesToLoad) throws IOException, InvalidJadException(Code)(Java Doc)
protected void putProperty(String key, String value)(Code)(Java Doc)
protected String readLine(Reader in) throws IOException(Code)(Java Doc)

Fields inherited from java.util.Properties
protected Properties defaults(Code)(Java Doc)

Methods inherited from java.util.Properties
public String getProperty(String key)(Code)(Java Doc)
public String getProperty(String key, String defaultValue)(Code)(Java Doc)
public void list(PrintStream out)(Code)(Java Doc)
public void list(PrintWriter out)(Code)(Java Doc)
public synchronized void load(InputStream inStream) throws IOException(Code)(Java Doc)
public Enumeration propertyNames()(Code)(Java Doc)
public synchronized void save(OutputStream out, String header)(Code)(Java Doc)
public synchronized Object setProperty(String key, String value)(Code)(Java Doc)
public synchronized void store(OutputStream out, String header) throws IOException(Code)(Java Doc)

Methods inherited from java.util.Hashtable
public synchronized void clear()(Code)(Java Doc)
public synchronized boolean contains(Object value)(Code)(Java Doc)
public synchronized boolean containsKey(Object key)(Code)(Java Doc)
public synchronized Enumeration elements()(Code)(Java Doc)
public synchronized Object get(Object key)(Code)(Java Doc)
public boolean isEmpty()(Code)(Java Doc)
public synchronized Enumeration keys()(Code)(Java Doc)
public synchronized Object put(Object key, Object value)(Code)(Java Doc)
protected void rehash()(Code)(Java Doc)
public synchronized Object remove(Object key)(Code)(Java Doc)
public int size()(Code)(Java Doc)
public synchronized String toString()(Code)(Java Doc)

Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.