Package net.jsign.script
Class VBScript
- java.lang.Object
-
- net.jsign.script.VBScript
-
-
Constructor Summary
Constructors Constructor Description VBScript()
Create a Visual Basic script.VBScript(File file)
Create a Visual Basic script from the specified file and load its content.VBScript(File file, Charset encoding)
Create a Visual Basic script from the specified file and load its content.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
computeDigest(MessageDigest digest)
Computes the digest of the file.ASN1Object
createIndirectData(DigestAlgorithm digestAlgorithm)
Creates the SpcIndirectDataContent structure containing the digest of the file.String
getContent()
Returns the content of the script.List<CMSSignedData>
getSignatures()
Returns the Authenticode signatures on the file.void
save()
Saves the file.void
save(File file)
Save the script to the specified file.void
setContent(String content)
Sets the content of the script.void
setSignature(CMSSignedData signature)
Sets the signature of the file, overwriting the previous one.
-
-
-
Constructor Detail
-
VBScript
public VBScript()
Create a Visual Basic script. The encoding is assumed to be UTF-8.
-
VBScript
public VBScript(File file) throws IOException
Create a Visual Basic script from the specified file and load its content. If the file has no byte order mark the encoding is assumed to be UTF-8.- Parameters:
file
- the Visual Basic script- Throws:
IOException
- if an I/O error occurs
-
VBScript
public VBScript(File file, Charset encoding) throws IOException
Create a Visual Basic script from the specified file and load its content.- Parameters:
file
- the Visual Basic scriptencoding
- the encoding of the script if there is no byte order mark (if null UTF-8 is used by default)- Throws:
IOException
- if an I/O error occurs
-
-
Method Detail
-
computeDigest
public byte[] computeDigest(MessageDigest digest)
Description copied from interface:Signable
Computes the digest of the file.- Specified by:
computeDigest
in interfaceSignable
- Parameters:
digest
- the message digest to update- Returns:
- the digest of the file
-
getContent
public String getContent()
Returns the content of the script.- Returns:
- the content of the script
-
setContent
public void setContent(String content)
Sets the content of the script.- Parameters:
content
- the content of the script
-
getSignatures
public List<CMSSignedData> getSignatures()
Description copied from interface:Signable
Returns the Authenticode signatures on the file.- Specified by:
getSignatures
in interfaceSignable
- Returns:
- the signatures
-
setSignature
public void setSignature(CMSSignedData signature) throws IOException
Description copied from interface:Signable
Sets the signature of the file, overwriting the previous one.- Specified by:
setSignature
in interfaceSignable
- Parameters:
signature
- the signature to put- Throws:
IOException
- if an I/O error occurs
-
createIndirectData
public ASN1Object createIndirectData(DigestAlgorithm digestAlgorithm)
Description copied from interface:Signable
Creates the SpcIndirectDataContent structure containing the digest of the file.- Specified by:
createIndirectData
in interfaceSignable
- Parameters:
digestAlgorithm
- the digest algorithm to use- Returns:
- the SpcIndirectDataContent structure in ASN.1 format
-
save
public void save() throws IOException
Description copied from interface:Signable
Saves the file.- Specified by:
save
in interfaceSignable
- Throws:
IOException
- if an I/O error occurs
-
save
public void save(File file) throws IOException
Save the script to the specified file.- Parameters:
file
- the file to write- Throws:
IOException
- if an I/O error occurs
-
-