index.rst (8509B)
1 .. _mozilla_projects_nss_jss_using_jss: 2 3 Using JSS 4 ========= 5 6 .. _using_jss: 7 8 `Using JSS <#using_jss>`__ 9 -------------------------- 10 11 .. container:: 12 13 *Newsgroup:*\ `mozilla.dev.tech.crypto <news://news.mozilla.org:119/mozilla.dev.tech.crypto>`__ 14 15 If you have already `built 16 JSS <https://developer.mozilla.org/en-US/docs/JSS/Build_instructions_for_JSS_4.3.x>`__, or if you 17 are planning to use a binary release of JSS, here's how to get JSS working with your code. 18 19 | `Gather Components <#components>`__ 20 | `Setup your runtime environment <#runtime>`__ 21 | `Initialize JSS in your application <#init>`__ 22 23 .. _gather_components: 24 25 `Gather components <#gather_components>`__ 26 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 27 28 .. container:: 29 30 #. You need the JSS classes and the NSPR, NSS, and JSS shared libraries. 31 32 #. **NSPR and NSS Shared Libraries** 33 34 JSS uses the NSPR and NSS libraries for I/O and crypto. JSS version 3.0 linked statically with 35 NSS, so it only required NSPR. JSS versions 3.1 and later link dynamically with NSS, so they 36 also require the NSS shared libraries. 37 38 The exact library names vary according to the convention for each platform. For example, the 39 NSPR library is called ``nspr4.dll`` or ``libnspr4.dll`` on Windows and ``libnspr4.so`` on 40 Solaris. The following table gives the core names of the libraries, omitting the 41 platform-specific prefix and suffix. 42 43 +-------------------+-------------------------------------+--------------------------------------+ 44 | JSS Dependencies | | | 45 +-------------------+-------------------------------------+--------------------------------------+ 46 | Core Library Name | Description | Binary Release Location | 47 +-------------------+-------------------------------------+--------------------------------------+ 48 | nspr4 | NSPR OS abstraction layer | `htt | 49 | | | p://ftp.mozilla.org/pub/mozilla.org/ | 50 | | | nspr/releases <http://ftp.mozilla.or | 51 | | | g/pub/mozilla.org/nspr/releases/>`__ | 52 +-------------------+-------------------------------------+--------------------------------------+ 53 | plc4 | | NSPR standard C library replacement | 54 | | | functions | 55 +-------------------+-------------------------------------+--------------------------------------+ 56 | plds4 | | NSPR data structure types | 57 +-------------------+-------------------------------------+--------------------------------------+ 58 | nss3 | NSS crypto, PKCS #11, and utilities | `http://ftp.mozilla. | 59 | | | org/pub/mozilla.org/security/nss/rel | 60 | | | eases <http://ftp.mozilla.org/pub/mo | 61 | | | zilla.org/security/nss/releases/>`__ | 62 +-------------------+-------------------------------------+--------------------------------------+ 63 | ssl3 | | NSS SSL library | 64 +-------------------+-------------------------------------+--------------------------------------+ 65 | smime3 | | NSS S/MIME functions and types | 66 +-------------------+-------------------------------------+--------------------------------------+ 67 | nssckbi | | PKCS #11 module containing built-in | 68 | | | root CA certificates. Optional. | 69 +-------------------+-------------------------------------+--------------------------------------+ 70 | freebl_\* | | Processor-specific optimized | 71 | | | big-number arithmetic library. Not | 72 | | | present on all platforms. | 73 | | | :ref:`mozilla_projects_nss_introd | 74 | | | uction_to_network_security_services` | 75 +-------------------+-------------------------------------+--------------------------------------+ 76 | fort | | FORTEZZA support. Optional | 77 +-------------------+-------------------------------------+--------------------------------------+ 78 | swft | | PKCS #11 module implementing | 79 | | | FORTEZZA in software. Optional. | 80 +-------------------+-------------------------------------+--------------------------------------+ 81 82 If you built JSS from source, you have these libraries in the ``mozilla/dist/<platform>/lib`` 83 directory of your build tree. If you are downloading binaries, get them from the binary 84 release locations in the above table. You need to select the right version of the components, 85 based on the version of JSS you are using. Generally, it is safe to use a later version of a 86 component than what JSS was tested with. For example, although JSS 4.2 was tested with NSS 87 3.11. 88 89 ================== ========= ============== 90 Component Versions 91 JSS Version Component Tested Version 92 JSS 4.2 NSPR 4.6.4 93 \ NSS 3.11.4 94 JSS 3.4 NSPR 4.2.2 95 \ NSS 3.7.3 96 JSS 3.3 NSPR 4.2.2 97 \ NSS 3.6.1 or 3.7 98 JSS 3.2 NSPR 4.2 or 4.1.2 99 \ NSS 3.4.2 100 JSS 3.1.1 NSPR 4.1.2 101 \ NSS 3.3.1 102 JSS 3.1 NSPR 4.1.2 103 \ NSS 3.3 104 JSS 3.0 NSPR 3.5.1 105 ================== ========= ============== 106 107 #. **JSS Shared Library** 108 109 The JSS shared library is ``jss4.dll`` (Windows) or ``libjss4.so`` (Unix). If you built JSS 110 from source, it is in ``mozilla/dist/<platform>/lib``. If you are downloading binaries, get it 111 from http://ftp.mozilla.org/pub/mozilla.org/security/jss/releases/. 112 113 #. **JSS classes** 114 115 If you built JSS from source, the compiled JSS classes are in ``mozilla/dist/classes[_dbg]``. 116 You can put this directory in your classpath to run applications locally; or, you can package 117 the class files into a JAR file for easier distribution: 118 119 .. code:: 120 121 cd mozilla/dist/classes[_dbg] 122 zip -r ../jss42.jar . 123 124 If you are downloading binaries, get jss42.jar 125 from http://ftp.mozilla.org/pub/mozilla.org/security/jss/releases/. 126 127 .. _setup_your_runtime_environment: 128 129 `Setup your runtime environment <#setup_your_runtime_environment>`__ 130 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 131 132 .. container:: 133 134 You need to set some environment variables before building and running Java applications with 135 JSS. 136 137 ``CLASSPATH`` 138 Include the path containing the JSS classes you built, or the path to ``jss42.jar``. (The path 139 to ``jss34.jar`` ends with the string "/jss42.jar". It is not just the directory that contains 140 ``jss42.jar``.) 141 ``LD_LIBRARY_PATH`` (Unix) / ``PATH`` (Windows) 142 Include the path to the NSPR, NSS, and JSS shared libraries. 143 144 .. _initialize_jss_in_your_application: 145 146 `Initialize JSS in your application <#initialize_jss_in_your_application>`__ 147 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 148 149 .. container:: 150 151 Before calling any JSS methods, you must initialize JSS by calling one of the 152 ``CryptoManager.initialize`` methods. See the `javadoc <javadoc>`__ for more details.