7.3 Extending Kalong 289
36 {
37 throw new MDLException( "signed data item was tampered with" );
38 }
39
40 try
41 {
42 return (Serializable)signedObject.getObject();
43 } catch( Exception e )
44 {
45 throw new MDLException( e );
46 }
47 }
48
49 // ...
50 }
Protect Data Items for a Target Agency
Finally, we present the code to encr ypt a data item so that it can be read only
at a single target agency. The agent calls this method to store a data item
under the given name, which is encrypted with the public key of the agency
whose local keystore alias is given in parameter targetAlias.
Data encr yption is done in Java using objects of class Cipher, and we
assume that an object with name rsaCipher has been initialized to use
asymmetric RSA encryption. In line 9