2015年4月3日金曜日

License Verification Library (LVL) のVT

License Verification Library (LVL) のVT

ServerManagedPolicyでLVLを実装して動かしてみると、VT(Validity Timestamp、有効期間)の値(long型)がLong.MAX_VALUEになっていた。

これは、期間の定めが無く、いつまでも有効であることを意味している。
つまり、検査をするのは最初の1回だけであって、2回目以降は検査をしないということである。2回目以降は検査のためにネットへ接続はしないということであるので、インターネットへの接続を必要としないアプリであっても効果があるということである。

端末利用者にアプリをGoogle Playからダウンロードしてもらった後、ネットに接続している時に、アプリを1回起動して貰えれば検査は完了するのである。

以上がServerManagedPolicyの振る舞いであるが、常時インターネットに接続するアプリであれば、StrictPolicyを使うことを検討しても良い。もちろん、アプリを起動する度にインターネット経由で検査をするので、その分、遅くなるが。

Licensing Referenceに詳しい情報がある。
Table 1のCategoryがLicense check and result及びPolicyとして掲げられたName欄のクラスを必要に応じて適宜変更することになる。
CategoryがLibrary core, no integration neededとして掲げられたクラスは変更をする必要はない。例えば、ILicensingService.javaの冒頭には次のように書かれてある。
This file is auto-generated.  DO NOT MODIFY. Original file: aidl/ILicensingService.aidl
Table 2はGoogle Play serverが返してくる値をまとめた一覧である。基本はResponse Code欄にある値を参照すれば良い。Extras欄の意味は、「Server Response Extras」に説明が書かれている。
ExtrasはServerManagedPolicyでは実装している。
Policyとは、ServerManagedPolicy又はStrictPolicyの基底です。ServerManagedPolicyはひな形としてはGoogleが提供していますが、プログラマが適宜自己責任で改修を行い使うこととなっている、と思います。

以下は私なりの日本語訳です。

License validity period(ライセンス有効期間)

The Google Play licensing server sets a license validity period for all downloaded applications. The period expresses the interval of time over which an application's license status should be considered as unchanging and cacheable by a licensing Policy in the application.

Google Play licensing serverは、すべてのダウンロードされたアプリケーションのライセンスの有効期間を設定します。この期間は、アプリケーションでのライセンスPolicyに基づき、アプリケーションのライセンスの状態が
「不変であり」かつ「キャッシュが可能である」と考えられる時間間隔を表現しています。

The licensing server includes the validity period in its response to all license checks, appending an end-of-validity timestamp to the response as an extra under the key VT.

licensing serverは、ライセンス検査への応答の中に有効期間に関するデータを含めており、extraの「VT」というキーの中に、有効期間の最終日時のデータが有ります。

A Policy can extract the VT key value and use it to conditionally allow access to the application without rechecking the license, until the validity period expires.

Policyは、有効期間が満了するまで、ライセンスを再検査することなく、VTの値を、条件付きで、アプリケーションへのアクセスを許可するために使用することができます。

The license validity signals to a licensing Policy when it must recheck the licensing status with the licensing server.

ライセンス期間というものは、ライセンスPolicyがライセンスサーバーを使ってライセンス状態を再検査しなければならない時を示しています。

It is not intended to imply whether an application is actually licensed for use.

これは、アプリケーションが実際に使用が許可されているかどうかを意味するものではありません。

That is, when an application's license validity period expires, this does not mean that the application is no longer licensed for use 

それは、アプリケーションのライセンス有効期間が満了したとき、アプリケーションの使用が不許可になったことを意味しません。

rather, it indicates only that the Policy must recheck the licensing status with the server.

むしろ、それは、Policyはサーバを使ってライセンスの状態を再検査しなければならない、ということだけを示します。

It follows that, as long as the license validity period has not expired, it is acceptable for the Policy to cache the initial license status locally and return the cached license status instead of sending a new license check to the server.

つまり、ライセンスの有効期間が満了していない限り、Policyは、初期のライセンスのデータをローカルにキャッシュすること、そして(サーバにライセンスの検査を行わせるのではなく)キャッシュされたライセンスのデータを使うこと、が可能です。

The licensing server manages the validity period as a means of helping the application properly enforce licensing across the refund period offered by Google Play for paid applications. 

有料アプリケーションのために、アプリケーションが適切にライセンスを実施する手段として、ライセンスサーバーは有効期間を管理します。(acrossの意味不明)

It sets the validity period based on whether the application was purchased and, if so, how long ago. Specifically, the server sets a validity period as follows:

アプリケーションが購入されたかどうか、どのくらい前なのか、に基づいて有効期間を設定します。サーバが有効期間を設定するのは具体的には以下のとおりです。

●For a paid application, the server sets the initial license validity period so that the license response remains valid for as long as the application is refundable. A licensing Policy in the application may cache the result of the initial license check and does not need to recheck the license until the validity period has expired.

●有料アプリのために、サーバは初期のライセンスの有効期間を設定します。それにより、アプリが返金可能である限りは、ライセンスのレスポンスは有効の状態を維持し続けます。アプリケーションにおけるライセンスPolicyは、初期のライセンスチェックの結果をキャッシュすることができるし、有効期間が満了するまで、ライセンスを再検査する必要はありません。

●When an application is no longer refundable, the server sets a longer validity period — typically a number of days.

●アプリケーションがもはや払い戻しできない場合は、サーバは長い有効期間 - 通常は数日 を設定します。

●For a free application, the server sets the validity period to a very high value (long.MAX_VALUE). This ensures that, provided the Policy has cached the validity timestamp locally, it will not need to recheck the license status of the application in the future.

●無料のアプリケーションのために、サーバーは非常に高い値(Long.MAX_VALUE)を有効期間として設定します。これは、
Policyがローカルに有効期間に関するデータをキャッシュしてしまうことを保証します。今後ずっとアプリケーションのライセンスステータスを再検査する必要はありません。


0 件のコメント:

コメントを投稿