Java Tutorials

131. Exporting a Certificate Authenticating Your Public Key example using keytool in Java

By: Lakshmi : 2007-10-14

Description: Suppose you have used the jarsigner tool to sign a Java ARchive (JAR) file. Clients that want to use the file will want to authenticate your signature.


132. Importing the Certificate Reply from the CA example using keytool in Java

By: Kamini : 2007-10-14

Description: Once you've imported a certificate authenticating the public key of the CA you submitted your certificate signing request to (or there's already such a certificate in the "cacerts" file), you can import the certificate reply and thereby replace your self-signed certificate with a certificate chain. This chain is the one returned by the CA in response to your request (if the CA reply is a chain), or one constructed (if the CA reply is a single certificate) using the certificate reply and trusted certificates that are already available in the keystore where you import the reply or in the "cacerts" keystore file.


133. Importing a Certificate for the CA example using keytool in Java

By: Jagan : 2007-10-14

Description: You need to replace your self-signed certificate with a certificate chain, where each certificate in the chain authenticates the public key of the signer of the previous certificate in the chain, up to a "root" CA.


134. Generating Your Key Pair example using keytool in Java

By: Henry : 2007-10-14

Description: The first thing you need to do is create a keystore and generate the key pair. You could use a command such as the following:


135. Verifying a Signed JAR File example

By: Grenfel : 2007-10-14

Description: To verify a signed JAR file, that is, to verify that the signature is valid and the JAR file has not been tampered with, use a command such as the following: jarsigner -verify sbundle.jar


136. Signing a jar file example

By: Fanny Ong : 2007-10-14

Description: Suppose you have a JAR file named bundle.jar and you'd like to sign it using the private key of the user whose keystore alias is jane in the keystore named mystore in the working directory. Suppose the keystore password is myspass and the password for jane's private key is j638klm. You can use the following to sign the JAR file and name the signed JAR file sbundle.jar:


137. Using jar utility in Java - A jar tutorial

By: Emiley J : 2007-10-14

Description: The jar tool combines multiple files into a single JAR archive file. jar is a general-purpose archiving and compression tool, based on ZIP and the ZLIB compression format. However, jar was designed mainly to facilitate the packaging of java applets or applications into a single archive. When the components of an applet or application (.class files, images and sounds) are combined into a single archive, they may be downloaded by a java agent (like a browser) in a single HTTP transaction, rather than requiring a new connection for each piece. This dramatically improves download times. jar also compresses files and so further improves download time. In addition, it allows individual entries in a file to be signed by the applet author so that their origin can be authenticated. The syntax for the jar tool is almost identical to the syntax for the tar command. A jar archive can be used as a class path entry, whether or not it is compressed.


138. javac options in Java

By: Daniel Malcolm : 2007-10-14

Description: The compiler has a set of standard options that are supported on the current development environment and will be supported in future releases. An additional set of non-standard options are specific to the current virtual machine and compiler implementations and are subject to change in the future. Non-standard options begin with -X.


139. Requesting a Signed Certificate from a Certification Authority example using keytool in Java

By: Ivan Lim : 2007-10-14

Description: So far all we've got is a self-signed certificate. A certificate is more likely to be trusted by others if it is signed by a Certification Authority (CA). To get such a signature, you first generate a Certificate Signing Request (CSR), via the following:


140. The if-then-else Statement in Java

By: Jagan : 2007-10-13

Description: The if-then-else statement provides a secondary path of execution when an "if" clause evaluates to false. You could use an if-then-else statement in the applyBrakes method to take some action if the brakes are applied when the bicycle is not in motion. In this case, the action is to simply print an error message stating that the bicycle has already stopped.