| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private final PKCS7 | block
the PKCS7 block for this .DSA/.RSA/.EC file |
| private final CertificateFactory | |
| private HashMap | createdDigests
cache of created MessageDigest objects |
| private static final Debug | |
| private static final int | |
| public static final int | |
| private final ManifestDigester | md
the ManifestDigester |
| private static final String | |
| private final String | name
the name of the signature block file, uppercase and without the extension (.DSA/.RSA/.EC) |
| private JarConstraintsParameters | params
ConstraintsParameters for checking disabled algorithms |
| private final Map | permittedAlgs
Algorithms that have been previously checked against disabled constraints. |
| private byte[] | sfBytes
the raw bytes of the .SF file |
| private static int | |
| private final List | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | SignatureFileVerifier(List<CodeSigner[]> signerCache, ManifestDigester md, String
the name of the signature block file (.DSA/.RSA/.EC) name, byte[] the raw bytes of the signature block file rawBytes)Create the named SignatureFileVerifier. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static boolean | |
| public static String | Returns: the extensionthe key used to sign the JAR file key)Returns the signed JAR block file extension for a key. |
| private MessageDigest | |
| private CodeSigner[] | getSigners(SignerInfo[] infos, PKCS7 block)
Given the PKCS7 block and SignerInfo[], create an array of CodeSigner objects. |
| pack-priv String | getWeakAlgorithms(String header)
With a given header (*-DIGEST*), return a string that lists all the algorithms associated with the header. |
| private static int | |
| public static boolean | Returns: true if the input file name is a supported Signature File or PKCS7 block file namefile name s)Utility method used by JarVerifier and JarSigner to determine the signature file names and PKCS7 block files names that are supported |
| public static boolean | Returns: true if the path resides in META-INF directly, ignoring casethe path name to check name)Utility method used by JarVerifier and JarSigner to determine if a path is located directly in the META-INF/ directory |
| public static boolean | Returns: true if the input file name is signature relatedfile name name)Yet another utility method used by JarVerifier and JarSigner to determine what files are signature related, which includes the MANIFEST, SF files, known signature block files, and other unknown signature related files (those starting with SIG- with an optional [A-Z0-9]{1,3} extension right inside META-INF). |
| pack-priv static boolean | |
| pack-priv static boolean | matches(CodeSigner[] signers, CodeSigner[] oldSigners, CodeSigner[] newSigners)
returns true if signer contains exactly the same code signers as oldSigner and newSigner, false otherwise. |
| public boolean | needSignatureFile(String
the name of the .SF file without the extension name)returns true if we need this .SF file. |
| public boolean | |
| private boolean | permittedCheck(String key, String algorithm)
Check if algorithm is permitted using the permittedAlgs Map. |
| public void | |
| private void | processImpl(Hashtable<String, CodeSigner[]> signers, List<Object> manifestDigests, String manifestName)
|
| public void | setSignatureFile(byte[] sfBytes)
used to set the raw bytes of the .SF file when it is external to the signature block file. |
| pack-priv void | |
| private boolean | verifyManifestHash(Manifest sf, ManifestDigester md, List<Object> manifestDigests)
See if the whole manifest was signed. |
| private boolean | |
| private boolean | Returns: true if all the -Digest headers verifiedgiven the .SF digest header, and the data from the section in the manifest, see if the hashes match. |
| ATTR_DIGEST | back to summary |
|---|---|
| private static final String ATTR_DIGEST | |
| block | back to summary |
|---|---|
| private final PKCS7 block the PKCS7 block for this .DSA/.RSA/.EC file | |
| certificateFactory | back to summary |
|---|---|
| private final CertificateFactory certificateFactory | |
| createdDigests | back to summary |
|---|---|
| private HashMap<String, MessageDigest> createdDigests cache of created MessageDigest objects | |
| debug | back to summary |
|---|---|
| private static final Debug debug | |
| MAX_ARRAY_SIZE | back to summary |
|---|---|
| private static final int MAX_ARRAY_SIZE | |
| MAX_SIG_FILE_SIZE | back to summary |
|---|---|
| public static final int MAX_SIG_FILE_SIZE | |
| md | back to summary |
|---|---|
| private final ManifestDigester md the ManifestDigester | |
| META_INF | back to summary |
|---|---|
| private static final String META_INF | |
| name | back to summary |
|---|---|
| private final String name the name of the signature block file, uppercase and without the extension (.DSA/.RSA/.EC) | |
| params | back to summary |
|---|---|
| private JarConstraintsParameters params ConstraintsParameters for checking disabled algorithms | |
| permittedAlgs | back to summary |
|---|---|
| private final Map<String, Boolean> permittedAlgs Algorithms that have been previously checked against disabled constraints. | |
| sfBytes | back to summary |
|---|---|
| private byte[] sfBytes the raw bytes of the .SF file | |
| SIGNER_CACHE_SIZE | back to summary |
|---|---|
| private static int SIGNER_CACHE_SIZE | |
| signerCache | back to summary |
|---|---|
| private final List<CodeSigner[]> signerCache | |
| workaround | back to summary |
|---|---|
| private boolean workaround | |
| SignatureFileVerifier | back to summary |
|---|---|
| public SignatureFileVerifier(List<CodeSigner[]> signerCache, ManifestDigester md, String name, byte[] rawBytes) throws IOException, CertificateException Create the named SignatureFileVerifier.
| |
| contains | back to summary |
|---|---|
| pack-priv static boolean contains(CodeSigner[] set, CodeSigner signer) | |
| getBlockExtension | back to summary |
|---|---|
| public static String getBlockExtension(PrivateKey key) Returns the signed JAR block file extension for a key. Returns "DSA" for unknown algorithms. This is safe because the signature verification process does not require the extension to match the key algorithm as long as it is "RSA", "DSA", or "EC."
| |
| getDigest | back to summary |
|---|---|
| private MessageDigest getDigest(String algorithm) get digest from cache | |
| getSigners | back to summary |
|---|---|
| private CodeSigner[] getSigners(SignerInfo[] infos, PKCS7 block) throws IOException, NoSuchAlgorithmException, SignatureException, CertificateException Given the PKCS7 block and SignerInfo[], create an array of CodeSigner objects. We do this only *once* for a given signature block file. | |
| getWeakAlgorithms | back to summary |
|---|---|
| pack-priv String getWeakAlgorithms(String header) With a given header (*-DIGEST*), return a string that lists all the algorithms associated with the header. If there are none, return "Unknown Algorithm". | |
| initializeMaxSigFileSize | back to summary |
|---|---|
| private static int initializeMaxSigFileSize() | |
| isBlockOrSF | back to summary |
|---|---|
| public static boolean isBlockOrSF(String s) Utility method used by JarVerifier and JarSigner to determine the signature file names and PKCS7 block files names that are supported
| |
| isInMetaInf | back to summary |
|---|---|
| public static boolean isInMetaInf(String name) Utility method used by JarVerifier and JarSigner to determine if a path is located directly in the META-INF/ directory
| |
| isSigningRelated | back to summary |
|---|---|
| public static boolean isSigningRelated(String name) Yet another utility method used by JarVerifier and JarSigner to determine what files are signature related, which includes the MANIFEST, SF files, known signature block files, and other unknown signature related files (those starting with SIG- with an optional [A-Z0-9]{1,3} extension right inside META-INF).
| |
| isSubSet | back to summary |
|---|---|
| pack-priv static boolean isSubSet(CodeSigner[] subset, CodeSigner[] set) | |
| matches | back to summary |
|---|---|
| pack-priv static boolean matches(CodeSigner[] signers, CodeSigner[] oldSigners, CodeSigner[] newSigners) returns true if signer contains exactly the same code signers as oldSigner and newSigner, false otherwise. oldSigner is allowed to be null. | |
| needSignatureFile | back to summary |
|---|---|
| public boolean needSignatureFile(String name) returns true if we need this .SF file.
| |
| needSignatureFileBytes | back to summary |
|---|---|
| public boolean needSignatureFileBytes() returns true if we need the .SF file | |
| permittedCheck | back to summary |
|---|---|
| private boolean permittedCheck(String key, String algorithm) Check if algorithm is permitted using the permittedAlgs Map. If the algorithm is not in the map, check against disabled algorithms and store the result. If the algorithm is in the map use that result. False is returned for weak algorithm, true for good algorithms. | |
| process | back to summary |
|---|---|
| public void process(Hashtable<String, CodeSigner[]> signers, List<Object> manifestDigests, String manifestName) throws IOException, SignatureException, NoSuchAlgorithmException, CertificateException process the signature block file. Goes through the .SF file and adds code signers for each section where the .SF section hash was verified against the Manifest section. | |
| processImpl | back to summary |
|---|---|
| private void processImpl(Hashtable<String, CodeSigner[]> signers, List<Object> manifestDigests, String manifestName) throws IOException, SignatureException, NoSuchAlgorithmException, CertificateException | |
| setSignatureFile | back to summary |
|---|---|
| public void setSignatureFile(byte[] sfBytes) used to set the raw bytes of the .SF file when it is external to the signature block file. | |
| updateSigners | back to summary |
|---|---|
| pack-priv void updateSigners(CodeSigner[] newSigners, Hashtable<String, CodeSigner[]> signers, String name) | |
| verifyManifestHash | back to summary |
|---|---|
| private boolean verifyManifestHash(Manifest sf, ManifestDigester md, List<Object> manifestDigests) throws SignatureException See if the whole manifest was signed. | |
| verifyManifestMainAttrs | back to summary |
|---|---|
| private boolean verifyManifestMainAttrs(Manifest sf, ManifestDigester md) throws SignatureException | |
| verifySection | back to summary |
|---|---|
| private boolean verifySection(Attributes sfAttr, String name, ManifestDigester md) throws SignatureException given the .SF digest header, and the data from the section in the manifest, see if the hashes match. if not, throw a SecurityException.
| |