public class SU3File
extends java.lang.Object
修飾子とタイプ | フィールド | 説明 |
---|---|---|
static int |
CONTENT_BLOCKLIST |
|
static int |
CONTENT_NEWS |
|
static int |
CONTENT_PLUGIN |
|
static int |
CONTENT_RESEED |
|
static int |
CONTENT_ROUTER |
|
static int |
CONTENT_UNKNOWN |
|
static java.lang.String |
MAGIC |
|
static int |
TYPE_HTML |
|
static int |
TYPE_TXT_GZ |
|
static int |
TYPE_XML |
|
static int |
TYPE_XML_GZ |
|
static int |
TYPE_ZIP |
The file type is advisory and is application-dependent.
|
コンストラクタ | 説明 |
---|---|
SU3File(java.io.File file) |
|
SU3File(java.lang.String file) |
|
SU3File(I2PAppContext context,
java.io.File file) |
修飾子とタイプ | メソッド | 説明 |
---|---|---|
int |
getContentType() |
The ContentType is the trust domain for the content.
|
int |
getFileType() |
The file type is advisory and is application-dependent.
|
java.lang.String |
getSignerString() |
This does not check the signature, but it will fail if the signer is unknown,
unless setVerifySignature(false) has been called.
|
SigType |
getSigType() |
This does not check the signature, but it will fail if the signer is unknown,
unless setVerifySignature(false) has been called.
|
java.lang.String |
getVersionString() |
This does not check the signature, but it will fail if the signer is unknown,
unless setVerifySignature(false) has been called.
|
static void |
main(java.lang.String[] args) |
Parses command line arguments when this class is used from the command
line.
|
void |
setVerifySignature(boolean shouldVerify) |
Should the signature be verified? Default true
|
boolean |
verify() |
One-pass verify.
|
boolean |
verifyAndMigrate(java.io.File migrateTo) |
One-pass verify and extract the content.
|
void |
verifyHeader() |
This does not check the signature, but it will fail if the signer is unknown,
unless setVerifySignature(false) has been called.
|
void |
write(java.io.File content,
int fileType,
int contentType,
java.lang.String version,
java.lang.String signer,
java.security.PrivateKey privkey,
SigType sigType) |
One-pass wrap and sign the content.
|
public static final java.lang.String MAGIC
public static final int TYPE_ZIP
public static final int TYPE_XML
public static final int TYPE_HTML
public static final int TYPE_XML_GZ
public static final int TYPE_TXT_GZ
public static final int CONTENT_UNKNOWN
public static final int CONTENT_ROUTER
public static final int CONTENT_PLUGIN
public static final int CONTENT_RESEED
public static final int CONTENT_NEWS
public static final int CONTENT_BLOCKLIST
public SU3File(java.lang.String file)
public SU3File(java.io.File file)
public SU3File(I2PAppContext context, java.io.File file)
public void setVerifySignature(boolean shouldVerify)
public java.lang.String getVersionString() throws java.io.IOException
java.io.IOException
public java.lang.String getSignerString() throws java.io.IOException
java.io.IOException
public SigType getSigType() throws java.io.IOException
java.io.IOException
public int getContentType() throws java.io.IOException
java.io.IOException
public int getFileType() throws java.io.IOException
java.io.IOException
public void verifyHeader() throws java.io.IOException
java.io.IOException
public boolean verify() throws java.io.IOException
java.io.IOException
public boolean verifyAndMigrate(java.io.File migrateTo) throws java.io.IOException
migrateTo
- the output file, probably in zip format. Null for verify only.java.io.IOException
public void write(java.io.File content, int fileType, int contentType, java.lang.String version, java.lang.String signer, java.security.PrivateKey privkey, SigType sigType) throws java.io.IOException
content
- the input file, probably in zip formatfileType
- 0-255, 0 for zipcontentType
- 0-255version
- 1-255 bytes when converted to UTF-8signer
- ID of the public key, 1-255 bytes when converted to UTF-8java.io.IOException
public static void main(java.lang.String[] args)
args
- Command line parameters.