暗号化ではデータを安全に表現できますが、難読化ではデータベースの内容を不用意に閲覧されないことを目的とした簡易的なセキュリティを実現します。Ultra Light Java Edition データベースに格納されるデータは、デフォルトでは暗号化されません。
Ultra Light Java Edition データベースでデータを暗号化するには、独自の暗号制御を提供する必要があります。暗号制御は ConfigPersistent.setEncryption メソッドを使用して設定します。このメソッドにより、ページを暗号化および複合化する EncryptionControl オブジェクトが受け入れられます。
暗号化は、非永続データベースストアには使用できません。
BlackBerry アプリケーションでの、EncryptionControl インターフェイスを使用した Ultra Light Java Edition データベースの暗号化または難読化 API 技術の作成とカスタマイズ
前提条件
Ultra Light J API を実装する BlackBerry スマートフォン用の既存の Java アプリケーション
内容と備考
次のとおりです。
EncryptionControl インターフェイスを実装するクラスを作成します。
次の例では、暗号化インターフェイスを実装する Encryptor という名前の新しいクラスを作成しています。
static class Encryptor implements EncryptionControl { |
新しいクラスで initialize、encrypt、decrypt の各メソッドを実装します。
クラスは次のようになります。
static class Encryptor implements EncryptionControl { /** Decrypt a page stored in the database. * @param page_no the number of the page being decrypted * @param src the encrypted source page which was read from the database * @param tgt the decrypted page (filled in by method) */ public void decrypt( int page_no, byte[] src, byte[] tgt ) throws ULjException { // Your decryption method goes here. } /** Encrypt a page stored in the database. * @param page_no the number of the page being encrypted * @param src the unencrypted source * @param tgt the encrypted target page which will be written to the database (filled in by method) */ public void encrypt( int page_no, byte[] src, byte[] tgt ) throws ULjException { // Your encryption method goes here. } /** Initialize the encryption control with a password. * @param password the password */ public void initialize(String password) throws ULjException { // Your initialization method goes here. } } |
データベースに接続する前に、新しい暗号化制御クラスが指定されるように、API コードを更新します。
Configuration.setEncryption メソッドで暗号化制御を指定します。次の例は、データベースを参照する config という Configuration オブジェクトが作成されていることを前提として、暗号化制御を設定する方法を示しています。
config.setEncryption(new Encryptor()); |
「『BlackBerry デバイス上の Ultra Light J セキュリティ』」ホワイトペーパーには、セキュリティオプションに関する情報や、BlackBerry デバイスでの Ultra Light J アプリケーションに関する考慮事項 (デバイスの組み込みセキュリティをアプリケーションで操作する場合の利点と短所など) が記載されています。詳細については、 UltraLiteJ Security on BlackBerry Devices を参照してください。
![]() |
DocCommentXchange で意見交換できます
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |