Package net.jsign.cat
Class CatalogFile
- java.lang.Object
-
- net.jsign.cat.CatalogFile
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Signable
public class CatalogFile extends Object implements Signable
Windows Catalog file.- Since:
- 4.2
- See Also:
- Windows Drivers - Catalog Files and Digital Signatures
-
-
Constructor Summary
Constructors Constructor Description CatalogFile(File file)Create a Windows catalog from the specified file.CatalogFile(SeekableByteChannel channel)Create a Windows catalog from the specified channel.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()byte[]computeDigest(MessageDigest digest)Computes the digest of the file.org.bouncycastle.asn1.cms.ContentInfocreateContentInfo(DigestAlgorithm digestAlgorithm)Creates the ContentInfo structure to be signed.ASN1ObjectcreateIndirectData(DigestAlgorithm digestAlgorithm)Creates the SpcIndirectDataContent structure containing the digest of the file.List<CMSSignedData>getSignatures()Returns the Authenticode signatures on the file.static booleanisCatalogFile(File file)Tells if the specified file is a Windows catalog file.voidsave()Saves the file.voidsetSignature(CMSSignedData signature)Sets the signature of the file, overwriting the previous one.
-
-
-
Constructor Detail
-
CatalogFile
public CatalogFile(File file) throws IOException
Create a Windows catalog from the specified file.- Parameters:
file- the file to open- Throws:
IOException- if an I/O error occurs
-
CatalogFile
public CatalogFile(SeekableByteChannel channel) throws IOException
Create a Windows catalog from the specified channel.- Parameters:
channel- the channel to read the file from- Throws:
IOException- if an I/O error occurs
-
-
Method Detail
-
isCatalogFile
public static boolean isCatalogFile(File file)
Tells if the specified file is a Windows catalog file.- Parameters:
file- the file to check- Returns:
trueif the file is a Windows catalog,falseotherwise
-
close
public void close() throws IOException
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
createContentInfo
public org.bouncycastle.asn1.cms.ContentInfo createContentInfo(DigestAlgorithm digestAlgorithm)
Description copied from interface:SignableCreates the ContentInfo structure to be signed.- Specified by:
createContentInfoin interfaceSignable- Parameters:
digestAlgorithm- the digest algorithm to use- Returns:
- the ContentInfo structure in ASN.1 format
-
computeDigest
public byte[] computeDigest(MessageDigest digest)
Description copied from interface:SignableComputes the digest of the file.- Specified by:
computeDigestin interfaceSignable- Parameters:
digest- the message digest to update- Returns:
- the digest of the file
-
createIndirectData
public ASN1Object createIndirectData(DigestAlgorithm digestAlgorithm)
Description copied from interface:SignableCreates the SpcIndirectDataContent structure containing the digest of the file.- Specified by:
createIndirectDatain interfaceSignable- Parameters:
digestAlgorithm- the digest algorithm to use- Returns:
- the SpcIndirectDataContent structure in ASN.1 format
-
getSignatures
public List<CMSSignedData> getSignatures() throws IOException
Description copied from interface:SignableReturns the Authenticode signatures on the file.- Specified by:
getSignaturesin interfaceSignable- Returns:
- the signatures
- Throws:
IOException- if an I/O error occurs
-
setSignature
public void setSignature(CMSSignedData signature)
Description copied from interface:SignableSets the signature of the file, overwriting the previous one.- Specified by:
setSignaturein interfaceSignable- Parameters:
signature- the signature to put
-
save
public void save() throws IOException
Description copied from interface:SignableSaves the file.- Specified by:
savein interfaceSignable- Throws:
IOException- if an I/O error occurs
-
-