Java Doc for JarVerifier.java in  » Apache-Harmony-Java-SE » java-package » java » util » jar » 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 » Apache Harmony Java SE » java package » java.util.jar 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.util.jar.JarVerifier

JarVerifier
class JarVerifier (Code)
Non-public class used by JarFile and JarInputStream to manage the verification of signed jars. JarFile and JarInputStream objects will be expected to have a JarVerifier instance member which can be used to carry out the tasks associated with verifying a signed jar. These tasks would typically include:
  • verification of all signed signature files
  • confirmation that all signed data was signed only by the party or parties specified in the signature block data
  • verification that the contents of all signature files (i.e. .SF files) agree with the jar entries information found in the jar manifest.

Inner Class :static class VerifierEntry extends OutputStream

Field Summary
 byte[]mainAttributesChunk
    

Constructor Summary
 JarVerifier(String name)
     Constructs and answers with a new instance of JarVerifier.

Method Summary
 voidaddMetaEntry(String name, byte[] buf)
     Add a new meta entry to the internal collection of data held on each jar entry in the META-INF directory including the manifest file itself.
 Certificate[]getCertificates(String name)
     Returns all of the java.security.cert.Certificate instances that were used to verify the signature on the jar entry called name.
Parameters:
  name - the name of a jar entry.
public static  Vector<Certificate>getSignerCertificates(String signatureFileName, Map<String, Certificate[]> certificates)
     Returns a Vector of all of the java.security.cert.Certificate s that are associated with the signing of the named signature file.
Parameters:
  signatureFileName - the name of a signature file
Parameters:
  certificates - a Map of all of the certificate chainsdiscovered so far while attempting to verify the jar thatcontains the signature file signatureFileName.This object will have been previously set in the course of oneor more calls toJarVerifier.verifyJarSignatureFile(String,String,String,Map,Map)where it was passed in as the last argument.
 VerifierEntryinitEntry(String name)
     Called for each new jar entry read in from the input stream.
 booleanisSignedJar()
     Returns a boolean indication of whether or not the associated jar file is signed.
synchronized  booleanreadCertificates()
     If the associated jar file is signed, check on the validity of all of the known signatures. true if the associated jar is signed and aninternal check verifies the validity of the signature(s).false if the associated jar file has no entries atall in its META-INF directory.
 voidremoveMetaEntries()
     Remove all entries from the internal collection of data held about each jar entry in the META-INF directory.
 voidsetManifest(Manifest mf)
     Associate this verifier with the specified Manifest object.
 voidverifySignatures(VerifierEntry entry, ZipEntry zipEntry)
     Verifies that the digests stored in the manifest match the decrypted digests from the .SF file.

Field Detail
mainAttributesChunk
byte[] mainAttributesChunk(Code)




Constructor Detail
JarVerifier
JarVerifier(String name)(Code)
Constructs and answers with a new instance of JarVerifier.
Parameters:
  name - the name of the jar file being verified.




Method Detail
addMetaEntry
void addMetaEntry(String name, byte[] buf)(Code)
Add a new meta entry to the internal collection of data held on each jar entry in the META-INF directory including the manifest file itself. Files associated with the signing of a jar would also be added to this collection.
Parameters:
  name - the name of the file located in the META-INFdirectory.
Parameters:
  buf - the file bytes for the file called name.
See Also:   JarVerifier.removeMetaEntries()



getCertificates
Certificate[] getCertificates(String name)(Code)
Returns all of the java.security.cert.Certificate instances that were used to verify the signature on the jar entry called name.
Parameters:
  name - the name of a jar entry. an array of java.security.cert.Certificate.



getSignerCertificates
public static Vector<Certificate> getSignerCertificates(String signatureFileName, Map<String, Certificate[]> certificates)(Code)
Returns a Vector of all of the java.security.cert.Certificate s that are associated with the signing of the named signature file.
Parameters:
  signatureFileName - the name of a signature file
Parameters:
  certificates - a Map of all of the certificate chainsdiscovered so far while attempting to verify the jar thatcontains the signature file signatureFileName.This object will have been previously set in the course of oneor more calls toJarVerifier.verifyJarSignatureFile(String,String,String,Map,Map)where it was passed in as the last argument. all of the Certificate entries for the signer ofthe jar whose actions led to the creation of the named signaturefile.



initEntry
VerifierEntry initEntry(String name)(Code)
Called for each new jar entry read in from the input stream. This method constructs and returns a new VerifierEntry which contains the certificates used to sign the entry and its hash value as specified in the jar manifest.
Parameters:
  name - the name of an entry in a jar file which is not in theMETA-INF directory. a new instance of VerifierEntry which can be used bycallers as an OutputStream.



isSignedJar
boolean isSignedJar()(Code)
Returns a boolean indication of whether or not the associated jar file is signed. true if the jar is signed, falseotherwise.



readCertificates
synchronized boolean readCertificates()(Code)
If the associated jar file is signed, check on the validity of all of the known signatures. true if the associated jar is signed and aninternal check verifies the validity of the signature(s).false if the associated jar file has no entries atall in its META-INF directory. This situation isindicative of an invalid jar file.

Will also return true if the jar file is not signed.


throws:
  SecurityException - if the jar file is signed and it is determined that asignature block file contains an invalid signature for thecorresponding signature file.



removeMetaEntries
void removeMetaEntries()(Code)
Remove all entries from the internal collection of data held about each jar entry in the META-INF directory.
See Also:   JarVerifier.addMetaEntry(String,byte[])



setManifest
void setManifest(Manifest mf)(Code)
Associate this verifier with the specified Manifest object.
Parameters:
  mf - a java.util.jar.Manifest object.



verifySignatures
void verifySignatures(VerifierEntry entry, ZipEntry zipEntry)(Code)
Verifies that the digests stored in the manifest match the decrypted digests from the .SF file. This indicates the validity of the signing, not the integrity of the file, as it's digest must be calculated and verified when its contents are read.
Parameters:
  entry - the VerifierEntry associated with the specifiedzipEntry.
Parameters:
  zipEntry - an entry in the jar file
throws:
  SecurityException - if the digest value stored in the manifest does notagree with the decrypted digest as recovered from the.SF file.
See Also:   JarVerifier.initEntry(String)



Methods inherited from java.lang.Object
protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object object)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final public Class<? extends Object> getClass()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
final public void notify()(Code)(Java Doc)
final public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final public void wait(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait(long millis) 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.