SlideShare a Scribd company logo
1 of 41
Download to read offline
Android Market Licensing
Tony Chan
Agenda
• What is Market Licensing?
• Architecture
• Tips for securing your Market
Licensing implementation
• How to get started?
What is Market Licensing?
Tell you whether a user is
licensed to use your application
Details…
•  Protect your app on any devices that include
the Android Market app
•  You maintain full control of how your app
enforces its licensing status
•  Straightforward integration using the License
Verification Library (LVL). Any app with API
version 3 or higher can use this service.
•  The service is free
Architecture
Google
License
Server
Your App
LVL
Market App
Architecture
Bind
Signed
License
Status
User
& App
Data
User Info
Android Phone
Retrieve
Tips for securing your Market
Licensing implementation
Is my app secure after adding
Market Licensing EXACTLY like
the sample code?
NO!
いいえ!
Common Mistakes
• Used the sample code as-is
• Forgot to obfuscate the code
• Did not terminate their apps properly after
receiving a NOT_LICENSED response
• License validation logic was flawed (not
tested thoroughly)
Tips
Four areas to improve security:
• Code Obfuscation
• Modify the LVL code
• Make your application tamper-resistant
• Offload the license validation to a trusted
server
Code Obfuscation
1
responseCode -> k
checkAccess()->vw(); allow()->qb()
•  Can:
–  Remove symbols that reveal the original structure of a
compiled application
•  Can’t:
–  Prevent automated attacks
–  Alter the flow of your program
•  Obfuscator
–  ProGuard
ProGuard
1
• Free, Open Source under GPL
• http://proguard.sourceforge.net
• Blog post
– http://android-developers.blogspot.com/2010/09/
proguard-android-and-licensing-server.html
• Helper Project at code.google.com
– android-proguard-commandline
– Require Android SDK Tools v7 or above
Modify the LVL code
1
The goal is to make your implementation
unique
Three areas to modify:
• Core LVL logic
• Entry/exit points of the LVL
• How your application invokes LVL and
handles license response
Core LVL logic
1
Two classes - LicenseChecker and LicenseValidator
•  Replace switch statements with if statements.
•  Use hash functions to derive new values for any
constants used
•  Remove unused code
•  Move all the LVL code into your own package
•  Spawn additional threads to handle different parts of
the license validation
•  Replace functions with inline code where possible
Core LVL logic
1
public void verify(PublicKey publicKey, int responseCode, String	
signedData, String signature) {	
// ... Response validation code omitted for brevity ...	
switch (responseCode) {	
// In bytecode, LICENSED will be converted to the	
// constant 0x0	
case LICENSED:	
// NOT_LICENSED will be converted to the constant 0x1	
case NOT_LICENSED:	
handleResponse(LicenseResponse.NOT_LICENSED, data);	
break;	
// ... Extra response codes also removed for brevity ...	
}	
}
Original Sample code:
Core LVL logic
1
public void verify(PublicKey publicKey, int responseCode, String signedData,
String signature) {	
// ... Response validation code omitted for brevity … 	
java.util.zip.CRC32 crc32 = new java.util.zip.CRC32();	
crc32.update(responseCode);	
int transformedResponseCode = crc32.getValue();	
// crc32(LICENSED) == 3523407757	
if (transformedResponseCode == 3523407757) {	
LicenseResponse limiterResponse = 	
mDeviceLimiter.isDeviceAllowed(userId);	
handleResponse(limiterResponse, data);	
}	
// ... put unrelated application code here ...	
// crc32(NOT_LICENSED) == 2768625435	
if (transformedResponseCode == 2768625435) {	
userIsntLicensed();	
}	
}
Improved Sample code:
Use a hash function
to compute a new
response code value
Replace switch
statement with if
statements
Add unrelated code
to make it harder to
reverse engineer
Entry/exit points of the LVL
1
• Add additional arguments constructors and methods
• Remove Policy interface if no swappable policies
public LicenseChecker(Context context, Policy policy, String 	
encodedPublicKey, int nonce1, int nonce2)	
...	
public void allow(int nonce2);	
...	
public void dontAllow(int nonce1);	
...
Proper license check and response handling
1
•  Avoid putting license check code in onCreate() as
this method cannot be obfuscated
•  Invoke a different activity rather than a dialog to
inform users about license failure
•  Add additional finish() statements to make sure your
app is properly terminated when the user is not
licensed
•  Set a timer thread that will handle license check
properly after a timeout
Make your App Tamper-resistant
2
•  Add code to compare the current app’s signature with
the good known value (ideally from a server)
•  Add code to compute the checksum of the current
app’s files and compare it with the good known
checksum (ideally from a server)
•  Alter your code logic when your app is running in
debug mode
Offload license validation to a trusted server
2
Instead of doing the license validation on the Android
device, do it on a trusted server
• Pro:
–  Very difficult to crack
–  Can do more fine-grained license check (e.g. per
device)
• Con:
–  Effective only if your app serves online content
–  You have to maintain your own server
–  Harder to implement
Summary
2
•  Make your implementation is unique
•  Change it often (e.g. every release)
•  Make it difficult to trace when decompiled
•  Make it resistant to any changes
Be creative!
How to get started?
Signup Setup Integrate Test
Signup
•  Android Market publisher account
•  Have to use an existing account if you want to add
licensing support to your already published apps
•  What you can do with the publisher account:
-  Publish licensed and free apps
-  Obtain the public key to decrypt license responses
-  Test and debug licensing implementation
Signup Setup Integrate Test
Setup
•  Download the latest SDK in order to debug your
implementation in the emulator
•  Setup run-time environment
•  Setup project configuration
•  Download and setup the LVL
•  (Optional) Download the latest ADT Plug-in if you
want to include the LVL as an Android library
project
Signup Setup Integrate Test
SDK
API 8 (revision 2) or above, with Google APIs add-on
Signup Setup Integrate Test
Setup Run-time Environment
•  Device
-  Running Android 1.5 or above
-  Android Market app installed (should be
available in any compatible devices)
•  Emulator (Android Virtual Device)
-  Google APIs Add-On, API 8 (release 2) or above
-  Add a Google account and sign in using your
publisher account or test account credentials
Signup Setup Integrate Test
Setup Project Configuration
No changes required if your project is using
API version 3 (Android 1.5) or above
Time to upgrade!!!
Signup Setup Integrate Test
Download LVL
Signup Setup Integrate Test
Setup LVL
•  Move the library and the sample source code to a
new location (e.g. your Eclipse workspace)
Signup Setup Integrate Test
Setup LVL
•  Import the LVL as an Android library project
Signup Setup Integrate Test
ADT Plug-in
•  Check your current plug-in
Need new ADT if this is missing
Signup Setup Integrate Test
ADT Plug-in
•  Version 0.9.7 or above
•  https://dl-ssl.google.com/android/eclipse/
Signup Setup Integrate Test
Integrate your app with LVL
Add the licensing permission to the application
manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" ...">
...
<!– Devices with SDK version 3 or above have version of Android
Market that supports licensing. -->
<uses-sdk android:minSdkVersion="3" />
<!-- Required permission to check licensing. -->
<uses-permission
android:name="com.android.vending.CHECK_LICENSE" />
...
</manifest>
Signup Setup Integrate Test
Integrate your app with LVL
Define a Policy
•  Use one provided in the LVL
-  ServerManagedPolicy (Recommended)
-  Will cache license response and handle various conditions
-  StrictPolicy
-  License response must come from market license server
•  Pre-defined policies do not fit your needs
-  Implement the Policy interface
Signup Setup Integrate Test
Integrate your app with LVL
Signup Setup Integrate Test
•  Add code to check license in your app’s main
activity
•  (Optional) – Implement a DeviceLimiter
-  Need to keep track of all the devices yourself
Test Environment
Signup Setup Integrate Test
Test Environment
Signup Setup Integrate Test
Account Type Can check
license before
upload?
Can receive test
response?
Can set test
response?
Publisher Account Yes Yes Yes
Test Account No Yes No
Other No No No
Resources
4
•  Market Licensing developer guide
–  http://developer.android.com/guide/publishing/
licensing.html
•  Market Licensing 3-part series blog posts
–  http://android-developers.blogspot.com/2010/08/
licensing-server-news.html
–  http://android-developers.blogspot.com/2010/09/
securing-android-lvl-applications.html
–  http://android-developers.blogspot.com/2010/09/
proguard-android-and-licensing-server.html
Resources
4
•  LVL issue tracker
–  http://code.google.com/p/marketlicensing/issues/
•  Development and testing issues
–  http://groups.google.com/group/android-developers
–  http://stackoverflow.com/questions/tagged/android
•  Accounts, publishing, and deployment issues
–  http://www.google.com/support/forum/p/Android+Market
–  http://market.android.com/support/bin/answer.py?
answer=186113

More Related Content

What's hot

GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Ukraine
 
Selenium- A Software Testing Tool
Selenium- A Software Testing ToolSelenium- A Software Testing Tool
Selenium- A Software Testing ToolZeba Tahseen
 
Selenium - Introduction
Selenium - IntroductionSelenium - Introduction
Selenium - IntroductionANKUR-BA
 
Introducing OpenAPI Version 3.1
Introducing OpenAPI Version 3.1Introducing OpenAPI Version 3.1
Introducing OpenAPI Version 3.1SmartBear
 
The Magic Behind Faster API Development, Testing and Delivery with API Virtua...
The Magic Behind Faster API Development, Testing and Delivery with API Virtua...The Magic Behind Faster API Development, Testing and Delivery with API Virtua...
The Magic Behind Faster API Development, Testing and Delivery with API Virtua...SmartBear
 
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
Parasoft .TEST, Write better C# Code Using  Data Flow Analysis Parasoft .TEST, Write better C# Code Using  Data Flow Analysis
Parasoft .TEST, Write better C# Code Using Data Flow Analysis Engineering Software Lab
 
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01Aravindharamanan S
 
Silk Performer Presentation v1
Silk Performer Presentation v1Silk Performer Presentation v1
Silk Performer Presentation v1Sun Technlogies
 
Sonarqube
SonarqubeSonarqube
SonarqubeKalkey
 
Automated Developer Testing: Achievements and Challenges
Automated Developer Testing: Achievements and ChallengesAutomated Developer Testing: Achievements and Challenges
Automated Developer Testing: Achievements and ChallengesTao Xie
 
Rapid software testing and conformance with static code analysis
Rapid software testing and conformance with static code analysisRapid software testing and conformance with static code analysis
Rapid software testing and conformance with static code analysisRogue Wave Software
 
Java code coverage with JCov. Implementation details and use cases.
Java code coverage with JCov. Implementation details and use cases.Java code coverage with JCov. Implementation details and use cases.
Java code coverage with JCov. Implementation details and use cases.Alexandre (Shura) Iline
 
App Optimizations Using Qualcomm Snapdragon LLVM Compiler for Android
App Optimizations Using Qualcomm Snapdragon LLVM Compiler for AndroidApp Optimizations Using Qualcomm Snapdragon LLVM Compiler for Android
App Optimizations Using Qualcomm Snapdragon LLVM Compiler for AndroidQualcomm Developer Network
 
Understanding and Executing on API Developer Experience
Understanding and Executing on API Developer ExperienceUnderstanding and Executing on API Developer Experience
Understanding and Executing on API Developer ExperienceSmartBear
 
Developing for Android-Types of Android Application
Developing for Android-Types of Android ApplicationDeveloping for Android-Types of Android Application
Developing for Android-Types of Android ApplicationNandini Prabhu
 
Test parallelization using Jenkins
Test parallelization using JenkinsTest parallelization using Jenkins
Test parallelization using JenkinsRogue Wave Software
 
Learn Selenium - Online Guide
Learn Selenium - Online GuideLearn Selenium - Online Guide
Learn Selenium - Online Guidebigspire
 

What's hot (19)

GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
 
Selenium- A Software Testing Tool
Selenium- A Software Testing ToolSelenium- A Software Testing Tool
Selenium- A Software Testing Tool
 
Selenium - Introduction
Selenium - IntroductionSelenium - Introduction
Selenium - Introduction
 
Introducing OpenAPI Version 3.1
Introducing OpenAPI Version 3.1Introducing OpenAPI Version 3.1
Introducing OpenAPI Version 3.1
 
The Magic Behind Faster API Development, Testing and Delivery with API Virtua...
The Magic Behind Faster API Development, Testing and Delivery with API Virtua...The Magic Behind Faster API Development, Testing and Delivery with API Virtua...
The Magic Behind Faster API Development, Testing and Delivery with API Virtua...
 
Parasoft fda software compliance part2
Parasoft fda software compliance   part2Parasoft fda software compliance   part2
Parasoft fda software compliance part2
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
Parasoft .TEST, Write better C# Code Using  Data Flow Analysis Parasoft .TEST, Write better C# Code Using  Data Flow Analysis
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
 
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01
 
Silk Performer Presentation v1
Silk Performer Presentation v1Silk Performer Presentation v1
Silk Performer Presentation v1
 
Sonarqube
SonarqubeSonarqube
Sonarqube
 
Automated Developer Testing: Achievements and Challenges
Automated Developer Testing: Achievements and ChallengesAutomated Developer Testing: Achievements and Challenges
Automated Developer Testing: Achievements and Challenges
 
Rapid software testing and conformance with static code analysis
Rapid software testing and conformance with static code analysisRapid software testing and conformance with static code analysis
Rapid software testing and conformance with static code analysis
 
Java code coverage with JCov. Implementation details and use cases.
Java code coverage with JCov. Implementation details and use cases.Java code coverage with JCov. Implementation details and use cases.
Java code coverage with JCov. Implementation details and use cases.
 
App Optimizations Using Qualcomm Snapdragon LLVM Compiler for Android
App Optimizations Using Qualcomm Snapdragon LLVM Compiler for AndroidApp Optimizations Using Qualcomm Snapdragon LLVM Compiler for Android
App Optimizations Using Qualcomm Snapdragon LLVM Compiler for Android
 
Understanding and Executing on API Developer Experience
Understanding and Executing on API Developer ExperienceUnderstanding and Executing on API Developer Experience
Understanding and Executing on API Developer Experience
 
Developing for Android-Types of Android Application
Developing for Android-Types of Android ApplicationDeveloping for Android-Types of Android Application
Developing for Android-Types of Android Application
 
Test parallelization using Jenkins
Test parallelization using JenkinsTest parallelization using Jenkins
Test parallelization using Jenkins
 
Learn Selenium - Online Guide
Learn Selenium - Online GuideLearn Selenium - Online Guide
Learn Selenium - Online Guide
 

Similar to Google Developer Day 2010 Japan: マーケットライセンシングを使って Android アプリケーションを守るには (トニー チャン)

Android Penetration testing - Day 2
 Android Penetration testing - Day 2 Android Penetration testing - Day 2
Android Penetration testing - Day 2Mohammed Adam
 
AWS re:Invent 2016: DevOps on AWS: Accelerating Software Delivery with the AW...
AWS re:Invent 2016: DevOps on AWS: Accelerating Software Delivery with the AW...AWS re:Invent 2016: DevOps on AWS: Accelerating Software Delivery with the AW...
AWS re:Invent 2016: DevOps on AWS: Accelerating Software Delivery with the AW...Amazon Web Services
 
Getting started with android programming
Getting started with android programmingGetting started with android programming
Getting started with android programmingPERKYTORIALS
 
Application Lifecycle Management
Application Lifecycle ManagementApplication Lifecycle Management
Application Lifecycle ManagementAmazon Web Services
 
DevSecOps: Putting the Sec into the DevOps
DevSecOps: Putting the Sec into the DevOpsDevSecOps: Putting the Sec into the DevOps
DevSecOps: Putting the Sec into the DevOpsshira koper
 
Dev Ops on AWS - Accelerating Software Delivery - AWS-Summit SG 2017
Dev Ops on AWS - Accelerating Software Delivery - AWS-Summit SG 2017Dev Ops on AWS - Accelerating Software Delivery - AWS-Summit SG 2017
Dev Ops on AWS - Accelerating Software Delivery - AWS-Summit SG 2017Amazon Web Services
 
Logic apps and PowerApps - Integrate across your APIs
Logic apps and PowerApps - Integrate across your APIsLogic apps and PowerApps - Integrate across your APIs
Logic apps and PowerApps - Integrate across your APIsSriram Hariharan
 
DEFCON 18- These Aren't the Permissions You're Looking For
DEFCON 18- These Aren't the Permissions You're Looking ForDEFCON 18- These Aren't the Permissions You're Looking For
DEFCON 18- These Aren't the Permissions You're Looking ForMichael Scovetta
 
Six Strategies for Protecting Mobile Games Against Hackers, Crackers, and Cop...
Six Strategies for Protecting Mobile Games Against Hackers, Crackers, and Cop...Six Strategies for Protecting Mobile Games Against Hackers, Crackers, and Cop...
Six Strategies for Protecting Mobile Games Against Hackers, Crackers, and Cop...AppSolid by SEWORKS
 
Putting the Sec into DevOps
Putting the Sec into DevOpsPutting the Sec into DevOps
Putting the Sec into DevOpsMaytal Levi
 
ANZ Dev Lounge Session - Feb 2017
ANZ Dev Lounge Session - Feb 2017ANZ Dev Lounge Session - Feb 2017
ANZ Dev Lounge Session - Feb 2017Amazon Web Services
 
Thick Application Penetration Testing - A Crash Course
Thick Application Penetration Testing - A Crash CourseThick Application Penetration Testing - A Crash Course
Thick Application Penetration Testing - A Crash CourseNetSPI
 
Understand release engineering
Understand release engineeringUnderstand release engineering
Understand release engineeringgaoliang641
 
Hierarchy Viewer Internals
Hierarchy Viewer InternalsHierarchy Viewer Internals
Hierarchy Viewer InternalsKyungmin Lee
 
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer ToolsDevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer ToolsAmazon Web Services
 
Quickly Build a Native Mobile App for Your Community Using Salesforce Mobile SDK
Quickly Build a Native Mobile App for Your Community Using Salesforce Mobile SDKQuickly Build a Native Mobile App for Your Community Using Salesforce Mobile SDK
Quickly Build a Native Mobile App for Your Community Using Salesforce Mobile SDKSalesforce Developers
 
Twelve-Factor App: Software Application Architecture
Twelve-Factor App: Software Application ArchitectureTwelve-Factor App: Software Application Architecture
Twelve-Factor App: Software Application ArchitectureSigfred Balatan Jr.
 

Similar to Google Developer Day 2010 Japan: マーケットライセンシングを使って Android アプリケーションを守るには (トニー チャン) (20)

Android Penetration testing - Day 2
 Android Penetration testing - Day 2 Android Penetration testing - Day 2
Android Penetration testing - Day 2
 
AWS re:Invent 2016: DevOps on AWS: Accelerating Software Delivery with the AW...
AWS re:Invent 2016: DevOps on AWS: Accelerating Software Delivery with the AW...AWS re:Invent 2016: DevOps on AWS: Accelerating Software Delivery with the AW...
AWS re:Invent 2016: DevOps on AWS: Accelerating Software Delivery with the AW...
 
Getting started with android programming
Getting started with android programmingGetting started with android programming
Getting started with android programming
 
Application Lifecycle Management
Application Lifecycle ManagementApplication Lifecycle Management
Application Lifecycle Management
 
DevSecOps: Putting the Sec into the DevOps
DevSecOps: Putting the Sec into the DevOpsDevSecOps: Putting the Sec into the DevOps
DevSecOps: Putting the Sec into the DevOps
 
Dev Ops on AWS - Accelerating Software Delivery - AWS-Summit SG 2017
Dev Ops on AWS - Accelerating Software Delivery - AWS-Summit SG 2017Dev Ops on AWS - Accelerating Software Delivery - AWS-Summit SG 2017
Dev Ops on AWS - Accelerating Software Delivery - AWS-Summit SG 2017
 
Logic apps and PowerApps - Integrate across your APIs
Logic apps and PowerApps - Integrate across your APIsLogic apps and PowerApps - Integrate across your APIs
Logic apps and PowerApps - Integrate across your APIs
 
DEFCON 18- These Aren't the Permissions You're Looking For
DEFCON 18- These Aren't the Permissions You're Looking ForDEFCON 18- These Aren't the Permissions You're Looking For
DEFCON 18- These Aren't the Permissions You're Looking For
 
Six Strategies for Protecting Mobile Games Against Hackers, Crackers, and Cop...
Six Strategies for Protecting Mobile Games Against Hackers, Crackers, and Cop...Six Strategies for Protecting Mobile Games Against Hackers, Crackers, and Cop...
Six Strategies for Protecting Mobile Games Against Hackers, Crackers, and Cop...
 
00.pdf
00.pdf00.pdf
00.pdf
 
Putting the Sec into DevOps
Putting the Sec into DevOpsPutting the Sec into DevOps
Putting the Sec into DevOps
 
ANZ Dev Lounge Session - Feb 2017
ANZ Dev Lounge Session - Feb 2017ANZ Dev Lounge Session - Feb 2017
ANZ Dev Lounge Session - Feb 2017
 
Thick Application Penetration Testing - A Crash Course
Thick Application Penetration Testing - A Crash CourseThick Application Penetration Testing - A Crash Course
Thick Application Penetration Testing - A Crash Course
 
Understand release engineering
Understand release engineeringUnderstand release engineering
Understand release engineering
 
Hierarchy Viewer Internals
Hierarchy Viewer InternalsHierarchy Viewer Internals
Hierarchy Viewer Internals
 
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer ToolsDevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
 
Quickly Build a Native Mobile App for Your Community Using Salesforce Mobile SDK
Quickly Build a Native Mobile App for Your Community Using Salesforce Mobile SDKQuickly Build a Native Mobile App for Your Community Using Salesforce Mobile SDK
Quickly Build a Native Mobile App for Your Community Using Salesforce Mobile SDK
 
Twelve-Factor App: Software Application Architecture
Twelve-Factor App: Software Application ArchitectureTwelve-Factor App: Software Application Architecture
Twelve-Factor App: Software Application Architecture
 
Test Automation Framework with BDD and Cucumber
Test Automation Framework with BDD and CucumberTest Automation Framework with BDD and Cucumber
Test Automation Framework with BDD and Cucumber
 
Android Development
Android DevelopmentAndroid Development
Android Development
 

More from Google Developer Relations Team

Google Developer Day 2010 Japan: Google エンジニアの日常 (山内 知昭)
Google Developer Day 2010 Japan: Google エンジニアの日常 (山内 知昭)Google Developer Day 2010 Japan: Google エンジニアの日常 (山内 知昭)
Google Developer Day 2010 Japan: Google エンジニアの日常 (山内 知昭)Google Developer Relations Team
 
Google Developer Day 2010 Japan: 音声入力 API for Android (アレックス グランスタイン, 小西 祐介)
Google Developer Day 2010 Japan: 音声入力 API for Android (アレックス グランスタイン, 小西 祐介)Google Developer Day 2010 Japan: 音声入力 API for Android (アレックス グランスタイン, 小西 祐介)
Google Developer Day 2010 Japan: 音声入力 API for Android (アレックス グランスタイン, 小西 祐介)Google Developer Relations Team
 
Google Developer Day 2010 Japan: 「App Engine 開発者コミュニティ「appengine ja night」とフレ...
Google Developer Day 2010 Japan: 「App Engine 開発者コミュニティ「appengine ja night」とフレ...Google Developer Day 2010 Japan: 「App Engine 開発者コミュニティ「appengine ja night」とフレ...
Google Developer Day 2010 Japan: 「App Engine 開発者コミュニティ「appengine ja night」とフレ...Google Developer Relations Team
 
Google Developer Day 2010 Japan: Part 1: Google App Engine for Business の概要 P...
Google Developer Day 2010 Japan: Part 1: Google App Engine for Business の概要 P...Google Developer Day 2010 Japan: Part 1: Google App Engine for Business の概要 P...
Google Developer Day 2010 Japan: Part 1: Google App Engine for Business の概要 P...Google Developer Relations Team
 
Google Developer Day 2010 Japan: Google App Engine についての最新情報 (松尾貴史)
Google Developer Day 2010 Japan: Google App Engine についての最新情報 (松尾貴史)Google Developer Day 2010 Japan: Google App Engine についての最新情報 (松尾貴史)
Google Developer Day 2010 Japan: Google App Engine についての最新情報 (松尾貴史)Google Developer Relations Team
 
Google Developer Day 2010 Japan: Google Chrome の Developer Tools (ミカイル ナガノフ, ...
Google Developer Day 2010 Japan: Google Chrome の Developer Tools (ミカイル ナガノフ, ...Google Developer Day 2010 Japan: Google Chrome の Developer Tools (ミカイル ナガノフ, ...
Google Developer Day 2010 Japan: Google Chrome の Developer Tools (ミカイル ナガノフ, ...Google Developer Relations Team
 
Google Developer DAy 2010 Japan: HTML5 についての最新情報 (マイク スミス)
Google Developer DAy 2010 Japan: HTML5 についての最新情報 (マイク スミス)Google Developer DAy 2010 Japan: HTML5 についての最新情報 (マイク スミス)
Google Developer DAy 2010 Japan: HTML5 についての最新情報 (マイク スミス)Google Developer Relations Team
 
Google Developer Day 2010 Japan: 新 SocialWeb: 全てはオープンスタンダードの元に (ティモシー ジョーダン)
Google Developer Day 2010 Japan: 新 SocialWeb: 全てはオープンスタンダードの元に (ティモシー ジョーダン)Google Developer Day 2010 Japan: 新 SocialWeb: 全てはオープンスタンダードの元に (ティモシー ジョーダン)
Google Developer Day 2010 Japan: 新 SocialWeb: 全てはオープンスタンダードの元に (ティモシー ジョーダン)Google Developer Relations Team
 
Google Developer Day 2010 Japan: Android や iPhone で活用する Maps API のモバイル端末向け新機能...
Google Developer Day 2010 Japan: Android や iPhone で活用する Maps API のモバイル端末向け新機能...Google Developer Day 2010 Japan: Android や iPhone で活用する Maps API のモバイル端末向け新機能...
Google Developer Day 2010 Japan: Android や iPhone で活用する Maps API のモバイル端末向け新機能...Google Developer Relations Team
 
Google Developer Day 2010 Japan: プログラミング言語 Go (鵜飼 文敏)
Google Developer Day 2010 Japan: プログラミング言語 Go (鵜飼 文敏)Google Developer Day 2010 Japan: プログラミング言語 Go (鵜飼 文敏)
Google Developer Day 2010 Japan: プログラミング言語 Go (鵜飼 文敏)Google Developer Relations Team
 
Google Developer Day 2010 Japan: HTML5 とウェブサイトデザイン (矢倉 眞隆)
Google Developer Day 2010 Japan: HTML5 とウェブサイトデザイン (矢倉 眞隆)Google Developer Day 2010 Japan: HTML5 とウェブサイトデザイン (矢倉 眞隆)
Google Developer Day 2010 Japan: HTML5 とウェブサイトデザイン (矢倉 眞隆)Google Developer Relations Team
 
Google Developer Day 2010 Japan: Android でリアルタイムゲームを開発する方法: リベンジ (クリス プルエット)
Google Developer Day 2010 Japan: Android でリアルタイムゲームを開発する方法: リベンジ (クリス プルエット)Google Developer Day 2010 Japan: Android でリアルタイムゲームを開発する方法: リベンジ (クリス プルエット)
Google Developer Day 2010 Japan: Android でリアルタイムゲームを開発する方法: リベンジ (クリス プルエット)Google Developer Relations Team
 
Google Developer Day 2010 Japan: クールな Android アプリを作るには (安生真, 山下盛史, 江川崇)
Google Developer Day 2010 Japan: クールな Android アプリを作るには (安生真, 山下盛史, 江川崇)Google Developer Day 2010 Japan: クールな Android アプリを作るには (安生真, 山下盛史, 江川崇)
Google Developer Day 2010 Japan: クールな Android アプリを作るには (安生真, 山下盛史, 江川崇)Google Developer Relations Team
 
Google Developer Day 2010 Japan: 高性能な Android アプリを作るには (ティム ブレイ)
Google Developer Day 2010 Japan: 高性能な Android アプリを作るには (ティム ブレイ)Google Developer Day 2010 Japan: 高性能な Android アプリを作るには (ティム ブレイ)
Google Developer Day 2010 Japan: 高性能な Android アプリを作るには (ティム ブレイ)Google Developer Relations Team
 

More from Google Developer Relations Team (14)

Google Developer Day 2010 Japan: Google エンジニアの日常 (山内 知昭)
Google Developer Day 2010 Japan: Google エンジニアの日常 (山内 知昭)Google Developer Day 2010 Japan: Google エンジニアの日常 (山内 知昭)
Google Developer Day 2010 Japan: Google エンジニアの日常 (山内 知昭)
 
Google Developer Day 2010 Japan: 音声入力 API for Android (アレックス グランスタイン, 小西 祐介)
Google Developer Day 2010 Japan: 音声入力 API for Android (アレックス グランスタイン, 小西 祐介)Google Developer Day 2010 Japan: 音声入力 API for Android (アレックス グランスタイン, 小西 祐介)
Google Developer Day 2010 Japan: 音声入力 API for Android (アレックス グランスタイン, 小西 祐介)
 
Google Developer Day 2010 Japan: 「App Engine 開発者コミュニティ「appengine ja night」とフレ...
Google Developer Day 2010 Japan: 「App Engine 開発者コミュニティ「appengine ja night」とフレ...Google Developer Day 2010 Japan: 「App Engine 開発者コミュニティ「appengine ja night」とフレ...
Google Developer Day 2010 Japan: 「App Engine 開発者コミュニティ「appengine ja night」とフレ...
 
Google Developer Day 2010 Japan: Part 1: Google App Engine for Business の概要 P...
Google Developer Day 2010 Japan: Part 1: Google App Engine for Business の概要 P...Google Developer Day 2010 Japan: Part 1: Google App Engine for Business の概要 P...
Google Developer Day 2010 Japan: Part 1: Google App Engine for Business の概要 P...
 
Google Developer Day 2010 Japan: Google App Engine についての最新情報 (松尾貴史)
Google Developer Day 2010 Japan: Google App Engine についての最新情報 (松尾貴史)Google Developer Day 2010 Japan: Google App Engine についての最新情報 (松尾貴史)
Google Developer Day 2010 Japan: Google App Engine についての最新情報 (松尾貴史)
 
Google Developer Day 2010 Japan: Google Chrome の Developer Tools (ミカイル ナガノフ, ...
Google Developer Day 2010 Japan: Google Chrome の Developer Tools (ミカイル ナガノフ, ...Google Developer Day 2010 Japan: Google Chrome の Developer Tools (ミカイル ナガノフ, ...
Google Developer Day 2010 Japan: Google Chrome の Developer Tools (ミカイル ナガノフ, ...
 
Google Developer DAy 2010 Japan: HTML5 についての最新情報 (マイク スミス)
Google Developer DAy 2010 Japan: HTML5 についての最新情報 (マイク スミス)Google Developer DAy 2010 Japan: HTML5 についての最新情報 (マイク スミス)
Google Developer DAy 2010 Japan: HTML5 についての最新情報 (マイク スミス)
 
Google Developer Day 2010 Japan: 新 SocialWeb: 全てはオープンスタンダードの元に (ティモシー ジョーダン)
Google Developer Day 2010 Japan: 新 SocialWeb: 全てはオープンスタンダードの元に (ティモシー ジョーダン)Google Developer Day 2010 Japan: 新 SocialWeb: 全てはオープンスタンダードの元に (ティモシー ジョーダン)
Google Developer Day 2010 Japan: 新 SocialWeb: 全てはオープンスタンダードの元に (ティモシー ジョーダン)
 
Google Developer Day 2010 Japan: Android や iPhone で活用する Maps API のモバイル端末向け新機能...
Google Developer Day 2010 Japan: Android や iPhone で活用する Maps API のモバイル端末向け新機能...Google Developer Day 2010 Japan: Android や iPhone で活用する Maps API のモバイル端末向け新機能...
Google Developer Day 2010 Japan: Android や iPhone で活用する Maps API のモバイル端末向け新機能...
 
Google Developer Day 2010 Japan: プログラミング言語 Go (鵜飼 文敏)
Google Developer Day 2010 Japan: プログラミング言語 Go (鵜飼 文敏)Google Developer Day 2010 Japan: プログラミング言語 Go (鵜飼 文敏)
Google Developer Day 2010 Japan: プログラミング言語 Go (鵜飼 文敏)
 
Google Developer Day 2010 Japan: HTML5 とウェブサイトデザイン (矢倉 眞隆)
Google Developer Day 2010 Japan: HTML5 とウェブサイトデザイン (矢倉 眞隆)Google Developer Day 2010 Japan: HTML5 とウェブサイトデザイン (矢倉 眞隆)
Google Developer Day 2010 Japan: HTML5 とウェブサイトデザイン (矢倉 眞隆)
 
Google Developer Day 2010 Japan: Android でリアルタイムゲームを開発する方法: リベンジ (クリス プルエット)
Google Developer Day 2010 Japan: Android でリアルタイムゲームを開発する方法: リベンジ (クリス プルエット)Google Developer Day 2010 Japan: Android でリアルタイムゲームを開発する方法: リベンジ (クリス プルエット)
Google Developer Day 2010 Japan: Android でリアルタイムゲームを開発する方法: リベンジ (クリス プルエット)
 
Google Developer Day 2010 Japan: クールな Android アプリを作るには (安生真, 山下盛史, 江川崇)
Google Developer Day 2010 Japan: クールな Android アプリを作るには (安生真, 山下盛史, 江川崇)Google Developer Day 2010 Japan: クールな Android アプリを作るには (安生真, 山下盛史, 江川崇)
Google Developer Day 2010 Japan: クールな Android アプリを作るには (安生真, 山下盛史, 江川崇)
 
Google Developer Day 2010 Japan: 高性能な Android アプリを作るには (ティム ブレイ)
Google Developer Day 2010 Japan: 高性能な Android アプリを作るには (ティム ブレイ)Google Developer Day 2010 Japan: 高性能な Android アプリを作るには (ティム ブレイ)
Google Developer Day 2010 Japan: 高性能な Android アプリを作るには (ティム ブレイ)
 

Recently uploaded

DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 

Recently uploaded (20)

DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 

Google Developer Day 2010 Japan: マーケットライセンシングを使って Android アプリケーションを守るには (トニー チャン)

  • 1.
  • 3. Agenda • What is Market Licensing? • Architecture • Tips for securing your Market Licensing implementation • How to get started?
  • 4. What is Market Licensing? Tell you whether a user is licensed to use your application
  • 5. Details… •  Protect your app on any devices that include the Android Market app •  You maintain full control of how your app enforces its licensing status •  Straightforward integration using the License Verification Library (LVL). Any app with API version 3 or higher can use this service. •  The service is free
  • 8. Tips for securing your Market Licensing implementation
  • 9. Is my app secure after adding Market Licensing EXACTLY like the sample code? NO! いいえ!
  • 10. Common Mistakes • Used the sample code as-is • Forgot to obfuscate the code • Did not terminate their apps properly after receiving a NOT_LICENSED response • License validation logic was flawed (not tested thoroughly)
  • 11. Tips Four areas to improve security: • Code Obfuscation • Modify the LVL code • Make your application tamper-resistant • Offload the license validation to a trusted server
  • 12. Code Obfuscation 1 responseCode -> k checkAccess()->vw(); allow()->qb() •  Can: –  Remove symbols that reveal the original structure of a compiled application •  Can’t: –  Prevent automated attacks –  Alter the flow of your program •  Obfuscator –  ProGuard
  • 13. ProGuard 1 • Free, Open Source under GPL • http://proguard.sourceforge.net • Blog post – http://android-developers.blogspot.com/2010/09/ proguard-android-and-licensing-server.html • Helper Project at code.google.com – android-proguard-commandline – Require Android SDK Tools v7 or above
  • 14. Modify the LVL code 1 The goal is to make your implementation unique Three areas to modify: • Core LVL logic • Entry/exit points of the LVL • How your application invokes LVL and handles license response
  • 15. Core LVL logic 1 Two classes - LicenseChecker and LicenseValidator •  Replace switch statements with if statements. •  Use hash functions to derive new values for any constants used •  Remove unused code •  Move all the LVL code into your own package •  Spawn additional threads to handle different parts of the license validation •  Replace functions with inline code where possible
  • 16. Core LVL logic 1 public void verify(PublicKey publicKey, int responseCode, String signedData, String signature) { // ... Response validation code omitted for brevity ... switch (responseCode) { // In bytecode, LICENSED will be converted to the // constant 0x0 case LICENSED: // NOT_LICENSED will be converted to the constant 0x1 case NOT_LICENSED: handleResponse(LicenseResponse.NOT_LICENSED, data); break; // ... Extra response codes also removed for brevity ... } } Original Sample code:
  • 17. Core LVL logic 1 public void verify(PublicKey publicKey, int responseCode, String signedData, String signature) { // ... Response validation code omitted for brevity … java.util.zip.CRC32 crc32 = new java.util.zip.CRC32(); crc32.update(responseCode); int transformedResponseCode = crc32.getValue(); // crc32(LICENSED) == 3523407757 if (transformedResponseCode == 3523407757) { LicenseResponse limiterResponse = mDeviceLimiter.isDeviceAllowed(userId); handleResponse(limiterResponse, data); } // ... put unrelated application code here ... // crc32(NOT_LICENSED) == 2768625435 if (transformedResponseCode == 2768625435) { userIsntLicensed(); } } Improved Sample code: Use a hash function to compute a new response code value Replace switch statement with if statements Add unrelated code to make it harder to reverse engineer
  • 18. Entry/exit points of the LVL 1 • Add additional arguments constructors and methods • Remove Policy interface if no swappable policies public LicenseChecker(Context context, Policy policy, String encodedPublicKey, int nonce1, int nonce2) ... public void allow(int nonce2); ... public void dontAllow(int nonce1); ...
  • 19. Proper license check and response handling 1 •  Avoid putting license check code in onCreate() as this method cannot be obfuscated •  Invoke a different activity rather than a dialog to inform users about license failure •  Add additional finish() statements to make sure your app is properly terminated when the user is not licensed •  Set a timer thread that will handle license check properly after a timeout
  • 20. Make your App Tamper-resistant 2 •  Add code to compare the current app’s signature with the good known value (ideally from a server) •  Add code to compute the checksum of the current app’s files and compare it with the good known checksum (ideally from a server) •  Alter your code logic when your app is running in debug mode
  • 21. Offload license validation to a trusted server 2 Instead of doing the license validation on the Android device, do it on a trusted server • Pro: –  Very difficult to crack –  Can do more fine-grained license check (e.g. per device) • Con: –  Effective only if your app serves online content –  You have to maintain your own server –  Harder to implement
  • 22. Summary 2 •  Make your implementation is unique •  Change it often (e.g. every release) •  Make it difficult to trace when decompiled •  Make it resistant to any changes Be creative!
  • 23. How to get started?
  • 25. Signup •  Android Market publisher account •  Have to use an existing account if you want to add licensing support to your already published apps •  What you can do with the publisher account: -  Publish licensed and free apps -  Obtain the public key to decrypt license responses -  Test and debug licensing implementation Signup Setup Integrate Test
  • 26. Setup •  Download the latest SDK in order to debug your implementation in the emulator •  Setup run-time environment •  Setup project configuration •  Download and setup the LVL •  (Optional) Download the latest ADT Plug-in if you want to include the LVL as an Android library project Signup Setup Integrate Test
  • 27. SDK API 8 (revision 2) or above, with Google APIs add-on Signup Setup Integrate Test
  • 28. Setup Run-time Environment •  Device -  Running Android 1.5 or above -  Android Market app installed (should be available in any compatible devices) •  Emulator (Android Virtual Device) -  Google APIs Add-On, API 8 (release 2) or above -  Add a Google account and sign in using your publisher account or test account credentials Signup Setup Integrate Test
  • 29. Setup Project Configuration No changes required if your project is using API version 3 (Android 1.5) or above Time to upgrade!!! Signup Setup Integrate Test
  • 30. Download LVL Signup Setup Integrate Test
  • 31. Setup LVL •  Move the library and the sample source code to a new location (e.g. your Eclipse workspace) Signup Setup Integrate Test
  • 32. Setup LVL •  Import the LVL as an Android library project Signup Setup Integrate Test
  • 33. ADT Plug-in •  Check your current plug-in Need new ADT if this is missing Signup Setup Integrate Test
  • 34. ADT Plug-in •  Version 0.9.7 or above •  https://dl-ssl.google.com/android/eclipse/ Signup Setup Integrate Test
  • 35. Integrate your app with LVL Add the licensing permission to the application manifest <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" ..."> ... <!– Devices with SDK version 3 or above have version of Android Market that supports licensing. --> <uses-sdk android:minSdkVersion="3" /> <!-- Required permission to check licensing. --> <uses-permission android:name="com.android.vending.CHECK_LICENSE" /> ... </manifest> Signup Setup Integrate Test
  • 36. Integrate your app with LVL Define a Policy •  Use one provided in the LVL -  ServerManagedPolicy (Recommended) -  Will cache license response and handle various conditions -  StrictPolicy -  License response must come from market license server •  Pre-defined policies do not fit your needs -  Implement the Policy interface Signup Setup Integrate Test
  • 37. Integrate your app with LVL Signup Setup Integrate Test •  Add code to check license in your app’s main activity •  (Optional) – Implement a DeviceLimiter -  Need to keep track of all the devices yourself
  • 39. Test Environment Signup Setup Integrate Test Account Type Can check license before upload? Can receive test response? Can set test response? Publisher Account Yes Yes Yes Test Account No Yes No Other No No No
  • 40. Resources 4 •  Market Licensing developer guide –  http://developer.android.com/guide/publishing/ licensing.html •  Market Licensing 3-part series blog posts –  http://android-developers.blogspot.com/2010/08/ licensing-server-news.html –  http://android-developers.blogspot.com/2010/09/ securing-android-lvl-applications.html –  http://android-developers.blogspot.com/2010/09/ proguard-android-and-licensing-server.html
  • 41. Resources 4 •  LVL issue tracker –  http://code.google.com/p/marketlicensing/issues/ •  Development and testing issues –  http://groups.google.com/group/android-developers –  http://stackoverflow.com/questions/tagged/android •  Accounts, publishing, and deployment issues –  http://www.google.com/support/forum/p/Android+Market –  http://market.android.com/support/bin/answer.py? answer=186113