Java Reference
In-Depth Information
The
VisualTagConnection
interface provides two methods:
readVisualTag
and
generateVisualTag
. The
readVisualTag
(which you see in the
decode
method in Listing 15-12)
method is straightforward, accepting the source image, the class of the source image, and
the encoding symbology; the bytes generated from a successful scan are returned as an
array of bytes. This method can throw an
IOException
or a
VisualTagCodingException
,
which indicates that the coding operation failed.
The
generateVisualTag
(which you see in the
encode
method in Listing 15-12) method
is the encoding counterpart to
readVisualTag
, and it accepts the data to encode, the class
to which the data should be encoded (presumably an
Image
or subclass), and a set of prop-
erties describing symbology-specific properties of the encoding operation. You should
always get these image properties for a specific symbology from the
SymbologyManager
by
invoking its
getImageProperties
method; the resulting properties define things like the
dimensions of the generated bar code as well as the pixel pitch.
Wrapping Up
The Java ME platform provides a modicum of security-related interfaces to application
developers, like the inclusion of HTTPS for secure network transactions. However, there's
more to crafting a secure application than simply encrypting network traffic; a secure
application may need to defend itself from threats including unauthorized use or access
to its private data.
Fortunately, solutions to security challenges exist, providing ciphers for data hiding,
digests and signatures to defend data against tampering and prove origination of a mes-
sage, and certificates to provide identity. The Java community has responded to the need
by implementing these security tools in a number of ways, including SATSA that JSR 177
defines; the open source Bouncy Castle API, which provides a comprehensive suite of
security and cryptographic interfaces; and higher-level building blocks to build secure
commerce applications, like the Contactless Communication API that JSR 257 defines.
The SATSA optional interfaces available on some devices provide various hardware
and software solutions to security problems, including APIs to access cryptographic
smart cards, infrastructure for the secure management of public keys, and a limited sub-
set of the JCA for encrypting and decrypting data. Using the SATSA optional interfaces,
your application can access a variety of smart cards using the GCF at either the level of
individual bytes or Java RMI if the device supports Java smart cards. Your application can
also use this API to perform encryption and decryption with symmetric ciphers.
The open source Bouncy Castle API provides a comprehensive suite of cryptographic
solutions to security problems, bringing with it support for many different kinds of
ciphers and message digests. It also provides implementations for other data representa-
tions, including ASN.1 and S/MIME, as well as support for OpenPGP encoding and
decoding. The interface is similar to that defined by SATSA for common operations such
as encryption, decryption, and the creation of message digests, and its clean-room