Sun Microsystems V2.0 manual Managing keys and sharing Sun SPOTs, Using short names for SPOTs

Page 18

remote.pan.id either on the command line or in the .sunspot.properties file in your user root folder.

Using short names for SPOTs

As a shortcut, it is possible to use short names for SPOTs instead of the full 16-digit IEEE address. To do this create a file called “spot.names” in your user home directory. The file should contain entries of the form:

<short-name>=<IEEE_ADDRESS>

for example

my-spot-1=0014.4F01.0000.0006

Note that these short names are used for all connections opened from host applications to remote SPOTs, but are not available on SPOTs themselves.

Take suitable actions during over-the-air downloads

During over-the-air downloads, an application should suspend operations that use radio or flash memory, or that are processor intensive.

To do this, you need to write a class that implements the interface com.sun.spot.peripheral.ota. IOTACommandServerListener, and attach it to the OTACommandServer with code something like this:

OTACommandServer otaServer = Spot.getInstance().getOTACommandServer(); IOTACommandServerListener myListener = new MyListener(); otaServer.addListener(myListener);

Your listener object will then receive callbacks preFlash() and postFlash() around each flash operation.

Managing keys and sharing Sun SPOTs

Background

When you update your Sun SPOT with a new library or application, or with a new config page, the data that you send is cryptographically signed. This is for two reasons:

to ensure that the code executing on your Sun SPOT contain valid bytecodes

to prevent remote attackers from downloading dangerous code to your Sun SPOT via the radio.

By default, each user of each SDK installation has their own public-private key pair to support this signing. This key pair is created automatically when that user first requires a key (for example, when deploying an application for the first time).

Factory-fresh Sun SPOTs are not associated with any owner and do not hold a public key. The first user to deploy an application to that device (either via USB or over-the-air) becomes its owner. During this process, the owner's public key is automatically transferred to the device. Only the owner is allowed to install new applications or make configuration changes. This is enforced by digitally signing the application or config page with the owner’s private key, and verifying the signature against the trusted public key stored on the device.

18

Image 18
Contents Page Page Contents Http protocol support Introduction Building and deploying Sun Spot applications Deploying and running a sample applicationBuild Successful Total time 3 seconds \MyApplication Ant -Dport=COM2 info Total time 4 seconds \MyApplication Total time 0 seconds \MyApplication Deploying a pre-existing jar Incorporating utility classes into your applicationManifest and resources Excluding files from the compilationOther user properties Using the Basestation Built-in propertiesOverview Set up Base Station configuration Remote operationIntroduction Connect a Sun Spot base station Take suitable actions during over-the-air downloads Using short names for SPOTsManaging keys and sharing Sun SPOTs BackgroundChanging the owner of a Sun Spot Sharing Sun SPOTsGenerating a new key-pair What is protected?Deploying and running a host application LimitationsIncorporating pre-existing jars into your host application Configuring network featuresYour own host application Mesh routingHardware configurations and USB power Trace routeLogging Page Overview of an application ThreadsThread priorities Sun Spot device libraries Sun Spot device libraryDevice Interface Persistent properties Accessing flash memory Overriding the Ieee addressUsart Radio communication library Program Radiogram protocol Client end Server endYou can open server radiogram connections in a similar way Broadcasting Radio properties Turning the receiver off and on Conserving power using deep sleep mode Monitoring radio activityShallow Sleep Activating deep sleep mode Deep SleepDeep sleep behaviour of the standard drivers USB inhibits deep sleepPreconditions for deep sleeping Device Condition to permit deep sleepWriting a device driver Configuring the http protocol Http protocol supportConfiguring projects in an IDE Socket Proxy GUI modeClasspath configuration Javadoc/source configurationDebugging Ant selectapplication Configuring NetBeans as a debug client Configuring Eclipse as a debug clientUsing library suites Advanced topicsWith adderlib as your current directory, execute the command Use the command Using the spot client SpotSerialPortException other exception in serial port comms Reference Persistent system propertiesProperty name Meaning Memory usage Contents of the arm directoryContents of the lib directory Start address Space UseContents of the bin directory preverify.exe Contents of the upgrade directory Contents of the tests directory