레이블이 License Verification Library인 게시물을 표시합니다. 모든 게시물 표시
레이블이 License Verification Library인 게시물을 표시합니다. 모든 게시물 표시

2011년 2월 10일 목요일

[Android Course][English][Theme] - Android Market LVL(License Verification Library) Usage




※ LVL(License Verification Library) ?
: LVL basically your application from one device to another device with a light kind of piracy attacks makes
(Note> that even if piracy is to buy in to your account if your application can not run)
: If you use LVL in my application at runtime through the App Market was actually a purchase to determine if the application. If you are running a normal buyer.

1. "Market Licensing Package" Install
- "Window -> Android SDK and AVD Manager" through the installation
: "Available Packages" through the "Market Licensing Package" installation


- "Installed Packages" Package is installed through the check














2. "market_licensing" library Confirm Folder
: "Android-sdk-windows \ market_licensing \ library" when applied LVL future, Im required library.
: LVL to apply the library can be used in two ways.
  - a link to the reference project is the way
  - another one copy to the library source by the project will be put.
(Google Developer's Guide as a reference project to link recommended.)

3. Publisher Account Settings
: LVL want to use to obtain public key from the Android Market.
Android Market Account, select Edit Profile to access your personal information, such as setting screens coming out down below.
- "Test Accounts" field testing a Google account and put the address is
- "Public Key" field is a string that is used in the program, so in the future If you save it, and
- "Test response" values while the shape may be further tested in the license.

4. "LVL library Project" Create
: "LVL library Project" to create a reason, every time "LVL library Source" rather than copying it easy because when you add the reference.
- "Eclipse" from the "File> New> Android Project" by choosing and creating a new project.
(Contents column "Create project from existing source" to select, based on a copy of "LVL library" folder and checked)

- "Com_android_vending_licensing" project created.


















5. "LVL library" Apply
- "Test Android Project" to create
(ex : LVL_Test_App)








- "Eclipse - Project - Properties" by selecting additional library.






























































- "AndroidManifest.xml" Add permission settings
: LVL for permission to run with the following additional
<uses-permission android:name="com.android.vending.CHECK_LICENSE />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

- "LVL library" import
import android.telephony.TelephonyManager;
import com.android.vending.licensing.AESObfuscator;
import com.android.vending.licensing.LicenseChecker;
import com.android.vending.licensing.LicenseCheckerCallback;
import com.android.vending.licensing.ServerManagedPolicy;

- "LicenseCheckerCallback" Implementation
    private class MyLicenseCheckerCallback implements LicenseCheckerCallback {
        @Override
        public void allow() {
            if (isFinishing()) {
                return;
            }
            // "License Authentication" Success
        }
        @Override
        public void applicationError(ApplicationErrorCode errorCode) {
         // "License Authentication" Error
        }
        @Override
        public void dontAllow() {
            if (isFinishing()) {
                return;
            }
         // "License Authentication" Fail
        }
    }

- "License Authentication" Initialization and Run
public class main extends Activity {

    // public key
    private static final String BASE64_PUBLIC_KEY = "public key ... ";
   
    // Random byte
    private static final byte[] SALT = {-6, 35, 50, -118, -13, -5, 73, -24, 11, 82, -15,
                         -12, 27, -17, -4, -113, -13, 42, -54, 79};
    private LicenseCheckerCallback m_LicenseCheckerCallback;
    private LicenseChecker m_Checker;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
       
        // "LicenseCheckerCallback" Initialize
        m_LicenseCheckerCallback = new MyLicenseCheckerCallback();
        // "Devices ID" Obtain
        TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        String deviceId = tm.getDeviceId();
        // "LicenseChecker" Initialize
        m_Checker = new LicenseChecker( this,
                   new ServerManagedPolicy(this, new AESObfuscator(SALT, getPackageName(), deviceId)),
                   BASE64_PUBLIC_KEY);
        // "License Validation" Exe
        m_Checker.checkAccess(m_LicenseCheckerCallback);
    }
    ...
}

6. APK Test
: "LVL" to test the "Android Market" will be up to the fee.
: "Publish" does not need to do to, "save" are worth LVL can test release.


In addition, inquiries, or questions, please contact us.
(joonryang@gmail.com)

[Android 강좌][Korean][테마] - Android Market LVL(License Verification Library) 사용법




※ LVL(License Verification Library) ?
: 기본적으로 LVL 은 여러분의 어플리케이션을 한 디바이스에서 다른 디바이스로 불법 복제하는 가벼운 종류의 공격을 방어해줍니다
(주> 불법 복제하더라도 해당 계정에 어플리케이션 구매 정보가 없으면 실행할 수 없음)
: 나의 어플리케이션에서 LVL을 사용하면 실행시에 마켓앱을 통해 실제로 구매가 된 어플인지를 확인을 한다. 정상적인 구매자라면 실행을 하게 된다.

1. "Market Licensing Package" 설치
- "Window -> Android SDK and AVD Manager"를 통해서 설치
: "Available Packages"를 통해서 "Market Licensing Package" 설치

- "Installed Packages"를 통해서 설치된 Package 확인














2. "market_licensing" library 폴더 확인
: "android-sdk-windows\market_licensing\library" 추후 LVL 적용 시, 필요한 library 임.
: LVL을 적용하기 위해 library를 두가지 방법으로 사용할 수 있음.
 - 하나는 레퍼런스 프로젝트로 연결하는 방법이고,
 - 다른 하나는 라이브러리 소스를 해당 프로젝트에 카피하여 넣는 것임.
(구글 개발자 가이드에는 레퍼런스 프로젝트로 연결하는 것을 권장함.)

3. Publisher 계정 설정
: LVL을 사용하려면 안드로이드 마켓에서 public key 를 얻어야 합니다.
안드로이드 마켓 계정에 접속하여 Edit Profile 을 선택하면 개인 정보 설정 밑에 아래와 같은 화면이 나옴.
- "Test Accounts" 란에는 테스트할 구글 계정 주소를 넣으면 되며,
- "Public Key" 란에 있는 문자열은 추후에 프로그램에서 사용할 것이므로 잘 저장해 두면 되며,
- "Test response" 값을 바꿔가면서 추후에 라이선스 테스트를 할 수 있음.

4. "LVL library Project" 생성
: "LVL library Project"를 생성하는 이유는, 매번 "LVL library Source"를 복사하는 것 보다 바로 레퍼런스를 추가하면 편리하기 때문입니다.

- "Eclipse"에서 "File > New > Android Project" 를 선택하셔서 새 프로젝트를 만듦.
(Contents 란에서 "Create project from existing source"를 선택하고, 위에서 복사해 둔 "LVL library" 폴더를 선택함)

- "com_android_vending_licensing" 프로젝트 생성됨.


















5. "LVL library" 적용
- "Test Android Project"를 생성
(ex : LVL_Test_App)








- "Eclipse - Project - Properties" 선택하여 library 추가.






























































- "AndroidManifest.xml" 권한 설정 추가
: LVL 실행을 위한 권한을 아래와 같이 추가
<uses-permission android:name="com.android.vending.CHECK_LICENSE />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

- "LVL library" import
import android.telephony.TelephonyManager;
import com.android.vending.licensing.AESObfuscator;
import com.android.vending.licensing.LicenseChecker;
import com.android.vending.licensing.LicenseCheckerCallback;
import com.android.vending.licensing.ServerManagedPolicy;

- "LicenseCheckerCallback" 구현
    private class MyLicenseCheckerCallback implements LicenseCheckerCallback {
        @Override
        public void allow() {
            if (isFinishing()) {
                return;
            }
            // "License Authentication" Success
        }
        @Override
        public void applicationError(ApplicationErrorCode errorCode) {
         // "License Authentication" Error
        }
        @Override
        public void dontAllow() {
            if (isFinishing()) {
                return;
            }
         // "License Authentication" Fail
        }
    }

- "License Authentication" 초기화 및 실행
public class main extends Activity {

    // public key
    private static final String BASE64_PUBLIC_KEY = "public key ... ";
   
    // Random byte
    private static final byte[] SALT = {-6, 35, 50, -118, -13, -5, 73, -24, 11, 82, -15,
                         -12, 27, -17, -4, -113, -13, 42, -54, 79};
    private LicenseCheckerCallback m_LicenseCheckerCallback;
    private LicenseChecker m_Checker;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
       
        // "LicenseCheckerCallback" Initialize
        m_LicenseCheckerCallback = new MyLicenseCheckerCallback();
        // "Devices ID" Obtain
        TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        String deviceId = tm.getDeviceId();
        // "LicenseChecker" Initialize
        m_Checker = new LicenseChecker( this,
                   new ServerManagedPolicy(this, new AESObfuscator(SALT, getPackageName(), deviceId)),
                   BASE64_PUBLIC_KEY);
        // "License Validation" Exe
        m_Checker.checkAccess(m_LicenseCheckerCallback);
    }
    ...
}

6. APK 테스트
: "LVL"을 테스트하기 위해서는 "Android Market"에 유료로 올라가 있어야 합니다.
: "publish" 까지 할 필요는 없으며, "save" 만 해 놓으면 LVL을 테스트할 수 있습니다.


추가로 문의 사항이나, 궁금한 점이 계시면 연락주세요.
(joonryang@gmail.com)
※ 도움이 되셨다면, ^^. 맨 위 광고클릭 좀..ㅎㅎ