Navigation:  Programming Cookbook > DolphinSure >

Creating your own Trusted Data

Previous pageReturn to chapter overviewNext page

In addition to its use for signing applets, DolphinSure can be used to create your own trusted data objects that are digitally signed so they can be transported across insecure networks. You should use the DolphinSureTrustedData class to do this. The process is best demonstrated by example:

First locate a certificate from your My Certificates store:

myCertificate := (ChoicePrompter create)

  caption: 'Choose a certificate';

  choices: DolphinSureCertificateStore myCertificates certificates;

  getTextBlock: [:cert | cert displayString];

  showModal.

 

Now create the trusted data:

trusted := DolphinSureTrustedData

  data: 'This message cannot be tampered with' asByteArray

  description: 'A test'

  publisherCertificate: myCertificate

  privateKey: YOUR_PRIVATE_KEY_INTEGER_HERE.

 

At this point the trusted object can be transported to a client machine perhaps by using an STB filer stream. On the client side the object is reconstituted and you can then display the publisher's certificate and decode the original data:

trusted publisherCertificate show. "Evaluate It"

 

Is the data valid?

trusted isValid. "Display It"

 

Verify that it is acceptable to access this data:

trusted trustedData asString. "Display it"

 

Try modifying the data:

trusted data at: 1 put: 99.

trusted trustedData asString. "Display it"