|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.squawk.security.verifier.SignatureVerifier
public class SignatureVerifier
Used to verify the signature of certain signed data, including Suites.
Field Summary | |
---|---|
static int |
BUFFER_SIZE
The numbe of bytes read from flash memory and passed to the signature verification per loop. |
static int |
MAXIMUM_HEADER_SIZE
The maximum size the header of a suite can have to be compatible with SignatureVerifier. |
Method Summary | |
---|---|
protected static void |
ensureInitialized()
|
static boolean |
getSuiteVerifiedFlag(int suiteAddress)
|
static void |
initialize(byte[] publicKeyBytes,
int offset,
int length)
|
static boolean |
isVerifiedSuite(String uri)
|
static void |
verify(byte[] buffer,
byte[] signature)
Verifies a buffer |
static void |
verify(byte[] buffer,
int bufferOffset,
int bufferLength,
byte[] signature,
int signatureOffset,
int signatureLength)
Verifies a buffer |
static void |
verifySuite(InputStream suiteIn)
Verifies a suite in flash memory. |
static void |
verifySuite(InputStream suiteIn,
boolean useNativeSHA)
Verifies a suite in flash memory using either the java Signature or a native read from flash and sha1 code. |
static void |
verifySuite(String uri)
Verifies a suite in flash memory. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BUFFER_SIZE
public static final int MAXIMUM_HEADER_SIZE
Method Detail |
---|
protected static void ensureInitialized() throws SignatureVerifierException
SignatureVerifierException
public static boolean getSuiteVerifiedFlag(int suiteAddress) throws IllegalArgumentException
IllegalArgumentException
public static void initialize(byte[] publicKeyBytes, int offset, int length) throws SignatureVerifierException
SignatureVerifierException
public static boolean isVerifiedSuite(String uri)
public static void verify(byte[] buffer, int bufferOffset, int bufferLength, byte[] signature, int signatureOffset, int signatureLength) throws SignatureVerifierException
SignatureVerifierException
public static void verify(byte[] buffer, byte[] signature) throws SignatureVerifierException, IOException
SignatureVerifierException
IOException
public static void verifySuite(InputStream suiteIn) throws SignatureVerifierException, IOException
suiteIn
- An input stream which allows retrieving a suite. This usually
is a FlashInputStream pointing to a suite in the flash memory.
SignatureVerifierException
IOException
public static void verifySuite(InputStream suiteIn, boolean useNativeSHA) throws SignatureVerifierException, IOException
Remark: The suite header must be shorter than MAXIMUM_HEADER_SIZE bytes. This is only guarenteed in the case that the suite is in flash memory on a Spot, because it is ensured in com/syn/squawk/suiteconverter/Suite.java by replacing the parentURL with a url of the form flash://
.lib. If the suite is a suite file on the desktop, this is not garanteed, because the parent URL can have any length. Furthermore verifySuite expects that the first integer after the object memory in the suite is the hash. This is only the case for suite converted for flashmemory, thus it won't work for other suites.
suiteIn
- An input stream which allows retrieving a suite. This usually
is a FlashInputStream pointing to a suite in the flash memory.useNativeSHA
- Use faster message digest computation. Native C is about 85x faster
than the pure Java version. useNativeSHA=true cannot be
used if NATIVE_VERIFICATION compile flag not set, and
useNativeSHA=false cannot be used if NATIVE_VERIFICATION_ONLY is
set.In this cases verifySuite will throw a RuntimeException
SignatureVerifierException
IOException
public static void verifySuite(String uri) throws SignatureVerifierException, IOException
uri
- A uri pointing to a suite in flash memory. (flash://[.lib])
SignatureVerifierException
IOException
|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |