FIM.Util.Crypto
Class JarUtils
java.lang.Object
|
+--FIM.Util.Crypto.JarUtils
- public class JarUtils
- extends Object
A class with utilities for JAR-files. Contains the following:
- Digesting of jar-files
- Signing of jar-files
- Creating a digested (MD5, SHA-1) and signed jar-file.
All procedures require that an jar-file already exists.
This class can also be used directly to sign jar-files: java FIM.Util.JarUtils JAR-file CertificateAndKeyFile NameOfSigner
ATTENTION: This uses undocumented classes from Sun. Might not work in future releases of JDK 1.2.
I couldn't get IAIK to read the SignedData structure of the actual signature files (*.DSA);
always dropped with "ParsingException: Couldn't parse object" (Wonderful message!!!!).
- Version:
- 1.0, 1.7.2000
- Author:
- Michael Sonntag
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
JarUtils
public JarUtils()
signJarFile
public static void signJarFile(String filename,
String signerName,
X509Certificate[] chain,
PrivateKey privateKey)
throws FileNotFoundException,
SignatureException
- Signs a jar-file.
- Parameters:
filename
- the jar-file to signsignerName
- the name of the signer (=entry name for signature file in directory META-INF)chain
- the certificate chain for the signerprivateKey
- the private key of the signer- Throws:
- SignatureException - if an error occured during signing
- FileNotFoundException - if the jar-file could not be found
digestJarFile
public static void digestJarFile(String filename,
String algorithm)
throws FileNotFoundException,
DigestException
- Digests a jar-file.
- Parameters:
filename
- the jar-file to digestalgorithm
- the algorithm used for digesting- Throws:
- DigestException - if an error occured during digesting
- FileNotFoundException - if the jar-file could not be found
createSignedJar
public static void createSignedJar(String filename,
String signerName,
X509Certificate[] chain,
PrivateKey privateKey)
throws SignatureException,
DigestException,
FileNotFoundException
- Digests a jar-file (MD5 and SHA-1) and signs it afterwards.
- Parameters:
filename
- the jar-file to signsignerName
- the name of the signer (=entry name for signature file in directory META-INF)chain
- the certificate chain for the signerprivateKey
- the private key of the signer- Throws:
- DigestException - if an error occured during digesting
- SignatureException - if an error occured during signing
- FileNotFoundException - if the jar-file could not be found
main
public static void main(String[] args)
- This class can also be used directly to sign jar-files:
java FIM.Util.JarUtils JAR-file CertificateAndKeyFile NameOfSigner
Submit a bug
Copyright 2000 Michael Sonntag & Institute for Information Processing and Microprocessor Technology (FIM), Johannes-Kepler-University Linz, Altenbergerstr. 69, A-4040 Linz, Austria.