2

個人のユーザー データを安全に保存して、アプリの起動時とデバイスのリセット時に保持できるようにする必要があります。

これは、最大で約 1000 文字と思われる文字列になります。

これには RIM KeyStore API を使用できると言われました。

さて、RIM KeyStore API の使用法に関するガイドを何時間もかけて調べました。JDE サンプルには、これに関して役立つものは何も含まれていません。

BB開発では珍しいらしいので、公式情報はほとんどありません。

私はこれこれを読みました。私にとって最良の選択は、PersistableRIMKeyStore を使用することです (デバイスのリセット後も持続します)。ただし、実装が正確にどうあるべきかを理解することはできません。

誰かがサンプル コードを手伝ったり、ガイドを教えてくれませんか? また、私の仕事にはもっと良い/簡単な方法/アプローチがあるかもしれませんので、それについて教えてください。

よろしくお願いします!!!

4

2 に答える 2

1

「PersistentStoreDemo」と同じストアを使用する場合は、[ファイル]->[インポート]->[Blackberryサンプル]に移動して取得できるかどうかわからない場合は、ストア内の情報を暗号化できます。さらに、ユーザーがコンテンツ保護をオンにしている場合は、ContentProtectedHashtableを使用して、その情報が暗号化されることを自動的に知ることができます。したがって、コンテンツ保護がない場合、情報は一度暗号化され、オンにすると、二重に暗号化されるだけでなく、アプリの名前空間の長いハッシュを推測するのが困難になります(明らかに、ストアを登録するために必要です)。以下は私が使用するものです:

package ca.dftr.phillyd.lib.persistables;

import net.rim.device.api.system.ApplicationDescriptor;
import net.rim.device.api.util.ContentProtectedHashtable;
import net.rim.device.api.util.Persistable;

/**
 * Basic class for storing application specific information. 
 * Information such as application settings or whether the license agreement was accepted.
 * For more complex and specific classes they should be implemented separately and implement persistable 
 * @author deforbes
 */
public class AppInfo extends ContentProtectedHashtable  implements Persistable {

    private String _appName = null;
    private String _version = null;

    /**
     * Constructs the application info, creates and persists a hashtable for application settings.
     * @param uniqueHexAppIdentifier Can be automatically created in resource class (BUNDLE_ID) or generated using other unique information.
     */
    public AppInfo() {    
        ApplicationDescriptor appDesc = ApplicationDescriptor.currentApplicationDescriptor();
        _appName = appDesc.getName();
        _version = appDesc.getVersion();
    }

    /**
     * Get the Name of the application
     * @return The application name from the app descriptor
     */
    public String getName()
    {
        return _appName;
    }

    /**
     * Get the Version of the application
     * @return The application version from the app descriptor
     */
    public String getVersion()
    {
        return _version;
    }
}

定数のクラス(必要に応じて上記に含めることができます)とともに。たとえば、私のPhillyDアプリから:

パッケージca.dftr.phillyd.lib.persistables;

/**
 * Keys for the AppInfo array
 * @author deforbes
 */
public class AppInfoKeys {
    public static final String QUALITY = "Quality";
    public static final String CHANNEL = "Channel";
    public static final String CHANNEL_NAME = "Channel_Name";
    public static final String SEARCH = "Search";
    public static final String LICENSE_ACCEPTED = "isLicenseAccepted";
    public static final String VIDEOS_PER_PAGE = "NumPerPage";
    public static final Boolean DOWNLOAD_THUMBS = new Boolean(true);
}
于 2011-08-21T05:35:44.507 に答える
0

PersistableRIMKeyStore は、RIM キー ストアを永続化するために使用されます。リセット後もユーザー データを永続化するには、PersistentStore を使用するだけで済みます。データを保護したい場合は、ContentProtectedHashtable または ContentProtectedVector を使用できます。

于 2011-08-21T19:22:46.120 に答える