This document provides information about signing your Android applications prior to publishing them for mobile device users.
이 문서는 모바일 디바이스 사용자들에게 여러분의 안드로이드 애플리케이션을 배포하기 이전에 사인하는 것에 대한 정보를 제공한다.
The Android system requires that all installed applications be digitally signed with a certificate whose private key is held by the application's developer. The Android system uses the certificate as a means of identifying the author of an application and establishing trust relationships between applications. The certificate is not used to control which applications the user can install. The certificate does not need to be signed by a certificate authority: it is perfectly allowable, and typical, for Android applications to use self-signed certificates.
안드로이드 시스템은 설치된 모든 애플리케이션이 인증서를 사용해서 디지털적으로 사인될 것을 요구한다. 그 인증서의 개인 키private key는 애플리케이션의 개발자에 의해 보유된다. 시스템은 그 인증서를 사용자가 어떤 애플리케이션을 설치할 수 있는지를 제어하기 위해서라기 보다는, 애플리케이션의 제작자를 식별하고 애플리케이션들간의 신뢰 관계를 확립하기 위한 수단으로 사용한다. 인증서는 인증 당국authority에 의해 사인될 필요는 없다: 안드로이드 애플리케이션은 자체적으로 사인된 인증서 사용이 완전히 허용되며, 그렇게 하는 것이 일반적이다.
The important points to understand about signing Android applications are:
안드로이드 애플리케이션에 사인하는 것을 이해하는데 중요한 점은 다음과 같다.
zipalign tool to optimize the final APK package.The Android system will not install or run an application that is not signed appropriately. This applies wherever the Android system is run, whether on an actual device or on the emulator. For this reason, you must set up signing for your application before you will be able to run or debug it on an emulator or device.
안드로이드 시스템은 적절하게 사인되지 않은 애플리케이션을 설치하거나 실행하지 않을 것이다. 이것은 실제 디바이스던 또는 에뮬레이터던 상관없이 안드로이드 시스템이 구동되는 어느 곳에서든 적용된다. 이러한 이유로, 여러분은 에뮬레이터나 디바이스에서 애플리케이션을 실행하거나 디버그하기 이전에 여러분의 애플리케이션에 대한 사인을 해야 한다.
The Android SDK tools assist you in signing your applications when debugging. Both the ADT Plugin for Eclipse and the Ant build tool offer two signing modes debug mode and release mode.
안드로이드 SDK 툴tool은 디버그할 때 여러분의 애플리케이션이 사인되게 하는 것을 지원한다. 이클립스의 ADT 플러그인과 Ant 빌드 툴tool 모두 디버그 모드debug mode와 릴리즈 모드release mode인 두 가지의 사인 모드signing mode를 제공한다.
Once your application is signed, don't forget to run zipalign on the APK
for additional optimization.
일단 여러분의 애플리케이션이 사인되면, 추가적인 최적화를 위해 APK에 zipalign을 실행하는 것을 잊지마라.
Some aspects of application signing may affect how you approach the development of your application, especially if you are planning to release multiple applications.
애플리케이션 사인의 어떤 측면은 여러분의 애플리케이션 개발에 접근하는 방법에 영향을 미칠 수도 있다. 특히 여러분이 여러 개의 애플리케이션을 릴리즈하려고 한다면 그럴 수 있다.
In general, the recommended strategy for all developers is to sign all of your applications with the same certificate, throughout the expected lifespan of your applications. There are several reasons why you should do so:
일반적으로 모든 개발자에게 권장하는 전략은 여러분의 애플리케이션의 전체 기대 수명 동안 동일한 인증서로 여러분의 모든 애플리케이션을 사인하는 것이다. 여러분이 그렇게 해야 하는 다음과 같은 몇 가지 이유가 있다.
Another important consideration in determining your signing strategy is how to set the validity period of the key that you will use to sign your applications.
여러분의 사인 전략을 결정하는 데 있어서 또 다른 중요한 고려 사항은 여러분의 애플리케이션을 사인하기 위해 사용할 키의 유효 기간을 설정하는 방법이다.
As you design your application, keep these points in mind and make sure to use a suitable certificate to sign your applications.
여러분의 애플리케이션을 디자인할 때, 이러한 점을 기억하고 애플리케이션을 사인하기 위한 알맞은 인증서를 사용하도록 하라.
Before you begin, you should make sure that
Keytool is available to the SDK build
tools. In most cases, you can tell the SDK build tools how to find Keytool by setting
your JAVA_HOME environment variable to references a suitable JDK.
Alternatively, you can add the JDK version of Keytool to your PATH variable.
키스토어Keystore와 디버그 키debug key 생성을 지원하기 위해, 여러분은 먼저 Keytool을 SDK 빌드 툴tool에서 사용가능한 지를 확인해야 한다. 대부분의 경우에, 여러분은 적합한 JDK를 레퍼런스하기 위해 여러분의 JAVA_HOME 환경 변수를 설정함으로써 SDK 빌드 툴tool이 Keytool을 찾는 방법을 알려줄 수 있다. 다른 방법으로는, 여러분의 PATH 변수에 Keytool의 JDK 버전을 추가할 수 있다.
If you are developing on a version of Linux that originally came with GNU Compiler for
Java, make sure that the system is using the JDK version of Keytool, rather than the gcj
version. If Keytool is already in your PATH, it might be pointing to a symlink at
/usr/bin/keytool. In this case, check the symlink target to be sure it points
to the Keytool in the JDK.
만약 여러분이 처음부터 Java GNU 컴파일러Compiler를 보유하고 있는 리눅스 버전에서 개발하고 있다면, 시스템이 gcj 버전이 아니라 Keytool의 JDK 버전을 사용하는 것을 보장하라. 만약 Keytool이 이미 여러분의 PATH에 있다면, 그것은 /usr/bin/keytool에서 심볼릭 링크로 포인팅pointing되어 지고 있을 지 모른다. 이 경우, 그 심볼릭 링크의 타겟이 JDK에 있는 Keytool을 가리키도록 그 심볼릭 링크 타겟을 확인하라.
If you will release your application to the public, you will also need to have the Jarsigner tool available on your machine. Both Jarsigner and Keytool are included in the JDK.
만약 애플리케이션을 일반 대중에게 릴리즈할 것이라면, 여러분 머신machine에 사용가능한 Jarsigner 툴tool을 가질 필요가 있다. Jarsigner와 Keytool은 모두 JDK에 포함되어 있다.
The Android build tools provide a debug signing mode that makes it easier for you to develop and debug your application, while still meeting the Android system requirement for signing your .apk. When using debug mode to build your app, the SDK tools invoke Keytool to automatically create a debug keystore and key. This debug key is then used to automatically sign the .apk, so you do not need to sign the package with your own key.
안드로이드 빌드 툴tool은 디버그 사인 모드를 제공한다. 이것은 여러분의 .apk를 사인하는 것에 대한 안드로이드 시스템 요구사항을 만족시키면서, 여러분이 애플리케이션을 좀 더 쉽게 개발하고 디버그할 수 있도록 한다. 여러분이 디버그 모드를 사용할 때, SDK 툴tool은 디버그 키스토어keystore와 키key를 생성하기 위해 Keytool을 부른다invoke. 이 디버그 키는 .apk를 자동으로 사인하기 위해 사용되어서, 여러분은 여러분 자신의 키로 패키지를 사인할 필요가 없다.
The SDK tools create the debug keystore/key with predetermined names/passwords:
SDK 도구는 미리 결정된 이름과 패스워드로 디버그 키스토어/키(keystore/key)를 생성한다.
If necessary, you can change the location/name of the debug keystore/key or supply a custom debug keystore/key to use. However, any custom debug keystore/key must use the same keystore/key names and passwords as the default debug key (as described above). (To do so in Eclipse/ADT, go to Windows > Preferences > Android > Build.)
필요하다면, 여러분은 디버그 키스토어/키keystore/key의 장소와 이름을 바꿀 수 있고, 또한 사용할 커스텀 디버그 키스토어/키keystore/key를 제공할 수 있다. 하지만 임의의 커스텀 키스토어/키keystore/key는 (위에서 설명한 대로) 디폴트 디버그 키와 동일한 키스토어/키keystore/key 이름과 패스워드를 사용해야 한다. (Eclipse/ADT에서 이를 수행하기 위해, 여러분은 Windows > Prefs > Android > Build를 사용할 수 있다.)
Caution: You cannot release your application to the public when signed with the debug certificate.
Caution: 애플리케이션이 디버그 인증서로 사인되어 있다면, 애플리케이션을 일반 대중에게 릴리즈 할 수 없음을 유의하라.
If you are developing in Eclipse/ADT (and have set up Keytool as described above in
Basic Setup for Signing),
signing in debug mode is enabled by default. When you run or debug your
application, ADT signs the .apk with the debug certificate, runs zipalign on the
package, then installs it on
the selected emulator or connected device. No specific action on your part is needed,
provided ADT has access to Keytool.
만약 여러분이 Eclipse/ADT에서 개발하고 있고 위에서 언급한 대로의 셋업 Keytool을 가지고 있다면, 디폴트로 디버그 모드로 사인하는 것이 활성화된다. 여러분의 애플리케이션을 실행하거나 디버그할 때, ADT는 디버그 인증서로 .apk를 사인하고 패키지에 대한 zipalign을 수행하고 에뮬레이터 또는 연결된 디바이스에 그것을 설치한다. Keytool에 대한 접근이 ADT에 제공된다면, 여러분 입장에서 필요한 액션은 없다.
If you are using Ant to build your .apk files, debug signing mode
is enabled by using the debug option with the ant command
(assuming that you are using a build.xml file generated by the
android tool). When you run ant debug to
compile your app, the build script generates a keystore/key and signs the .apk for you.
The script then also aligns the .apk with the zipalign tool.
No other action on your part is needed. Read
Developing In Other IDEs: Building
in debug mode for more information.
만약 여러분이 .apk 파일을 빌드하기 위해 앤트Ant를 사용하고 있다면, 디버그 사인 모드는 ant 커맨드와 함께 debug 옵션을 사용함으로써 활성화된다. 여러분이 android 툴tool에 의해 생성된 build.xml 파일을 사용한다고 가정할 때 그렇다. 여러분의 애플리케이션을 컴파일하기 위해 ant debug를 실행할 때, build 스크립트는 여러분을 위해 키스토어/키keystore/key를 생성하고 .apk를 사인한다. 여러분 입장에서 필요한 액션은 없다. 더 많은 정보에 대해서는 Developing In Other IDEs: Building in debug mode(http://developer.android.com/guide/developing/other-ide.html#DebugMode)를 읽어라.
The self-signed certificate used to sign your application in debug mode (the default on Eclipse/ADT and Ant builds) will have an expiration date of 365 days from its creation date.
(디폴트로 이클립스/ADT와 Ant 빌드시) 디버그 모드에서 여러분의 애플리케이션을 사인하는 데 사용되는 자체 사인된self-signed 인증서는 그것이 생성된 날짜로부터 365일의 만료 일자를 가질 것이다.
When the certificate expires, you will get a build error. On Ant builds, the error looks like this:
그 인증서가 만료되면, 여러분은 빌드 에러를 얻을 것이다. 앤트Ant 빌드에서, 그 에러는 아래와 같이 보인다.
debug: [echo] Packaging bin/samples-debug.apk, and signing it with a debug key... [exec] Debug Certificate expired on 8/4/08 3:43 PM
In Eclipse/ADT, you will see a similar error in the Android console.
Eclipse/ADT에서, 여러분은 안드로이드 콘솔console에서 비슷한 에러를 보게 될 것이다.
To fix this problem, simply delete the debug.keystore file.
The default storage location for AVDs is in ~/.android/avd on OS X and Linux,
in C:\Documents and Settings\\.android\ on Windows XP, and in
C:\Users\\.android\ on Windows Vista.
이 문제를 해결하기 위해서는, 간단하게 debug.keystore 파일을 삭제하라. AVD들을 위한 디폴트 저장공간 위치는 Linux/Mac OS X에서는 ~/.android/avd 이며, Windows XP에서는 C:\Documents and Settings\<user>\.android\ 이고, Windows Vista에서는 C:\Users\<user>\.android\ 이다.
The next time you build, the build tools will regenerate a new keystore and debug key.
여러분이 다음에 빌드할 때, 빌드 도구는 신규 키스토어keystore와 디버그 키debug key를 생성할 것이다.
Note that, if your development machine is using a non-Gregorian locale, the build tools may erroneously generate an already-expired debug certificate, so that you get an error when trying to compile your application. For workaround information, see the troubleshooting topic Ican'tcompile my app because the build tools generated an expired debug certificate.
여러분이 개발할 때 사용하는 기계가 태양력이 아닌non-Gregorian 로케일locale을 사용하고 있다면, 빌드 툴tool은 잘못되어 이미 만료된 디버그 인증서를 생성할 지도 모른다. 그러므로 여러분의 애플리케이션을 컴파일할 때 에러를 얻는다. 이 문제를 회피하는 법에 대한 정보에 대해서 ‘I can’t compile my app because the build tools generated an expired debug certificate.’에 대한 아래의 URL 정보를 보라. http://developer.android.com/guide/appendix/faq/troubleshooting.html#signingcalendar
When your application is ready for release to other users, you must:
여러분의 애플리케이션이 다른 사용자에게 릴리즈 할 준비가 되었을 때, 여러분은 다음과 같은 것을 해야 한다.
If you are developing in Eclipse with the ADT plugin, you can use the Export Wizard to perform the compile, sign, and align procedures. The Export Wizard even allows you to generate a new keystore and private key in the process. So if you use Eclipse, you can skip to Compile and sign with Eclipse ADT.
만약 여러분이 ADT 플러그인을 가진 이클립스를 사용한다면, 여러분은 개인 키private key를 가지고 apk를 컴파일하고 사인하고 얼라인align하기 위해 Export 위저드를 대신 사용할 수 있다. 그 Export 위저드는 여러분으로 하여금 그 과정에서 새로운 키스토어keystore와 개인 키private key를 생성하는 것까지 가능하게 한다. 따라서 여러분이 이클립스를 사용한다면 “이클립스 ADT를 사용해서 컴파일하고 사인하기” 섹션으로 건너 뛰어라.
In preparation for signing your application, you must first ensure that you have a suitable private key with which to sign. A suitable private key is one that:
여러분의 애플리케이션에 사인하는 것을 준비하면서, 여러분은 사인할 적합한 개인 키private key를 가지고 있는 지를 먼저 확인해야 한다. 적합한 개인 키private key는 아래와 같은 것이다.
If you plan to publish your application(s) on Android Market, note that a validity period ending after 22 October 2033 is a requirement. You can not upload an application if it is signed with a key whose validity expires before that date.
만약 여러분이 안드로이드 마켓에 여러분의 애플리케이션을 배포할 계획이라면, 유효기간이 2033년 10월 22일 이후에 끝나야 한다는 것에 유의하라. 여러분은 그 이전에 끝나는 유효 기간을 가진 키key로 사인된 애플리케이션은 업로드 할 수가 없다.
The key may be self-signed. If you do not have a suitable key, you must generate one using Keytool. Make sure that you have Keytool available, as described in Basic Setup.
그 키key는 자체적으로 사인될 수 있다. 여러분이 적합한 키key를 가지고 있지 않다면, Keytool을 사용해서 그것을 생성해야 한다. “사인을 위한 기본적 셋업” 섹션에서 설명된 대로, 여러분이 사용할 수 있는 Keytool을 가지고 있는지 확인하라.
To generate a self-signed key with Keytool, use the keytool
command and pass any of the options listed below (and any others, as
needed).
Keytool을 가지고 자체적으로 사인된 키key를 생성하기 위해서는, keytool 명령어를 사용해서 아래에 나열된 옵션들 중 어떤 것을 전달하라(필요하다면 다른것들도).
Warning: Keep your private key secure. Before you run Keytool, make sure to read Securing Your Private Key for a discussion of how to keep your key secure and why doing so is critically important to you and to users. In particular, when you are generating your key, you should select strong passwords for both the keystore and key.
Warning: 여러분의 개인 키를 안전하게 유지하라. 여러분이 Keytool을 실행하기 전에, 여러분의 키key를 안전하게 보유하는 방법과 그렇게 하는 것이 여러분과 사용자들에게 중요한 이유를 알기 위해 “개인 키를 안전하게 하기” 섹션을 읽도록 하라. 특히, 여러분의 키key를 생성할 때 키스토어keystore와 키key에 강력한 패스워드를 선택해야만 한다.
| Keytool Option | Description |
|---|---|
-genkey |
Generate a key pair (public and private keys) |
-v |
Enable verbose output. |
-keystore<keystore-name>.keystore |
A name for the keystore containing the private key. |
-storepass <password> |
A password for the keystore. As a security precaution, do not include this option in your command line unless you are working at a secure computer. If not supplied, Keytool prompts you to enter the password. In this way, your password is not stored in your shell history. |
-alias <alias_name> |
An alias for the key. |
-keyalg <alg> |
The encryption algorithm to use when generating the key. Both DSA and RSA are supported. |
-dname <name> |
A Distinguished Name that describes who created the key. The value is used as the issuer and subject fields in the self-signed certificate. Note that you do not need to specify this option in the command line. If not supplied, Jarsigner prompts you to enter each of the Distinguished Name fields (CN, OU, and so on). |
-validity <valdays> |
The validity period for the key, in days. Note: A value of 10000 or greater is recommended. |
-keypass <password> |
The password for the key. As a security precaution, do not include this option in your command line unless you are working at a secure computer. If not supplied, Keytool prompts you to enter the password. In this way, your password is not stored in your shell history. |
Here's an example of a Keytool command that generates a private key:
여기에 개인 키private key를 생성하는 Keytool 명령어에 대한 예제가 있다.
$ keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -validity 10000
Running the example command above, Keytool prompts you to provide
passwords for the keystore and key, and to provide the Distinguished
Name fields for your key. It then generates the keystore as a file called
my-release-key.keystore. The keystore and key are
protected by the passwords you entered. The keystore contains
a single key, valid for 10000 days. The alias is a name that you
will use later, to refer to this keystore when signing your application.
위의 예제 명령어를 실행하면 Keytool은 여러분에게 키스토어keystore와 키key에 대한 패스워드를 입력하고 여러분의 키key를 구별하는 이름 필드를 입력하라고 프롬프트prompt를 보인다. 그리고 나서 키스토어keystore를 my-release-key.keystore로 불리는 파일로 생성한다. 키스토어Keystore와 키key는 여러분이 입력한 패스워드에 의해 보호된다. 키스토어Keystore는 10,000일 동안 유효한 하나의 키를 포함한다. 앨리어스alias는 여러분의 애플리케이션을 사인할 때, 키스토어keystore를 참조하기 위해 여러분이 나중에 사용할 이름이다.
For more information about Keytool, see the documentation at http://java.sun.com/j2se/1.5.0/docs/tooldocs/#security
Keytool에 대한 더 많은 정보는http://java.sun.com/j2se/1.5.0/docs/tooldocs/#security를 보라.
In order to release your application to users, you must compile it in release mode. In release mode, the compiled application is not signed by default and you will need to sign it with your private key.
여러분의 애플리케이션 릴리즈를 준비하기 위해, 여러분은 그것을 릴리즈 모드에서 컴파일 해야 한다. 릴리즈 모드에서, 컴파일된 애플리케이션은 디폴트로 사인되지 않으므로 여러분은 그것을 여러분의 개인 키로 사인할 필요가 있다.
Caution: You can not release your application unsigned, or signed with the debug key.
Caution: 여러분은 사인되지 않은 애플리케이션 또는 디버그 키debug key로 사인된 애플리케이션을 릴리즈 할 수 없다.
To export an unsigned .apk from Eclipse, right-click the project in the Package
Explorer and select Android Tools > Export Unsigned Application
Package. Then specify the file location for the unsigned .apk.
(Alternatively, open your AndroidManifest.xml file in Eclipse, open
the Overview tab, and click Export an unsigned .apk.)
이클립스에서 사인되지 않은 .apk를 만들기 위해서는, Package Explorer의 프로젝트에서 마우스 우측 버튼을 클릭해서 Android Tools > Export Unsigned Application Package를 선택하라. 그런 다음에 사인되지 않은 .apk를 위한 파일 위치를 지정하라(다른 방법으로는, 이클립스에서 여러분의 AndroidManifest.xml 파일을 열고, Overview 탭을 열어서, Export an unsigned .apk 를 클릭하라).
Note that you can combine the compiling and signing steps with the Export Wizard. See Compiling and signing with Eclipse ADT.
여러분은 Export 위저드를 사용해서 컴파일과 사인 과정을 결합시킬 수 있다는 것에 주의하라. “이클립스 ADT를 사용해서 컴파일하고 사인하기” 섹션을 보라.
If you are using Ant, you can enable release mode by using the release option
with the ant command. For example, if you are running Ant from the
directory containing your build.xml file, the command would look like this:
만약 여러분이 앤트Ant를 사용하고 있다면, 여러분은 ant 명령어에 release 옵션을 사용함으로써 릴리즈 모드를 활성화할 수 있다. 예를 들어 만약 여러분의 build.xml 파일을 포함하고 있는 디렉토리에서 Ant를 실행하고 있다면 명령어는 아래와 같이 보일 것이다.
ant release
By default, the build script compiles the application .apk without signing it. The output file
in your project bin/ will be <your_project_name>-unsigned.apk.
Because the application .apk is still unsigned, you must manually sign it with your private
key and then align it using zipalign.
디폴트로, 빌드 스크립트는 애플리케이션 .apk를 사인하지 않고 빌드한다. 여러분의 프로젝트 bin/에 있는 출력파일은 <your_project_name>-unsigned.apk 일 것이다. 애플리케이션 .apk는 여전히 사인되어 있지 않기 때문에, 여러분은 그것을 여러분의 개인 키를 가지고 수작업으로 사인하고 zipalign을 이용하여 얼라인align해야 한다.
However, the Ant build script can also perform the signing
and aligning for you, if you have provided the path to your keystore and the name of
your key alias in the project's build.properties file. With this information provided,
the build script will prompt you for your keystore and alias password when you perform
ant release, it will sign the package and then align it. The final output
file in bin/ will instead be
<your_project_name>-release.apk. With these steps
automated for you, you're able to skip the manual procedures below (steps 3 and 4).
To learn how to specify your keystore and alias in the build.properties file,
see Developing In Other
IDEs: Building in release mode.
하지만, 여러분이 프로젝트의 build.properties 파일에 여러분의 키스토어/키 앨리어스의 경로를 제공한다면, Ant 빌드 스크립트는 또한 여러분을 위해 사인과 얼라인을 수행할 수 있다. 제공된 이 정보를 가지고, 여러분이 ant release 를 수행할 때 빌드 스크립트는 여러분의 키스토어와 앨리어스 패스워드를 입력하라고 프롬프트를 보일 것이다. 그리고 나서 빌드 스크립트는 패키지를 사인하고 얼라인할 것이다. bin/ 에 있는 최종 출력파일은 대신 <your_project_name>_release.apk 일 것이다. 여러분을 위한 자동화된 이 과정들을 사용하여, 여러분은 아래의 수작업 절차(과정 3, 4)를 건너 뛸 수 있다. build.properties 파일에 여러분의 키스토어와 앨리어스를 지정하는 방법을 알기 위해서는 아래의 URL에 있는 “Developing In Other IDEs: Building in release mode”를 보라. Developing In Other IDEs: Building in release mode.
When you have an application package that is ready to be signed, you can do sign it using the Jarsigner tool. Make sure that you have Jarsigner available on your machine, as described in Basic Setup. Also, make sure that the keystore containing your private key is available.
여러분이 실제 릴리즈를 위해 .apk 파일에 사인할 준비가 되었다면, 여러분은 Jarsigner 툴tool을 이용해서 그렇게 할 수 있다. “사인을 위한 기본적 셋업” 섹션에서 설명된 대로 여러분의 머신machine에 Jarsigner가 있는지 확인하라. 그리고 여러분의 개인 키private key를 가지고 있는 키스토어keystore가 유효한지도 확인하라.
To sign your application, you run Jarsigner, referencing both the application's .apk and the keystore containing the private key with which to sign the .apk. The table below shows the options you could use.
여러분의 애플리케이션을 사인 하기 위해서, 여러분은 애플리케이션의 .apk와 .apk를 사인할 개인 키private key를 가지고 있는 키스토어keystore 둘 모두를 레퍼런스하는 Jarsigner를 실행한다. 아래의 테이블은 여러분이 사용할 수 있는 옵션을 보여준다.
| Jarsigner Option | Description |
|---|---|
-keystore<keystore-name>.keystore |
The name of the keystore containing your private key. |
-verbose |
Enable verbose output. |
-storepass <password> |
The password for the keystore. As a security precaution, do not include this option in your command line unless you are working at a secure computer. If not supplied, Jarsigner prompts you to enter the password. In this way, your password is not stored in your shell history. |
-keypass <password> |
The password for the private key. As a security precaution, do not include this option in your command line unless you are working at a secure computer. If not supplied, Jarsigner prompts you to enter the password. In this way, your password is not stored in your shell history. |
Here's how you would use Jarsigner to sign an application package called
my_application.apk, using the example keystore created above.
여기에 위에서 생성한 예제 키스토어keystore를 사용하여 my_application.apk라고 불리는 애플리케이션 패키지에 사인하기 위한 Jarsigner 사용 방법이 있다.
$ jarsigner -verbose -keystore my-release-key.keystore my_application.apk alias_name
Running the example command above, Jarsigner prompts you to provide passwords for the keystore and key. It then modifies the .apk in-place, meaning the .apk is now signed. Note that you can sign an .apk multiple times with different keys.
위의 예제 명령을 실행하면, Jarsigner가 여러분에게 키스토어keystore와 키key에 대한 패스워드를 입력하라고 한다. 그러면 그것은 .apk를 수정하며, 이는 .apk가 이제 사인되었다는 것을 의미한다. 여러분이 다른 키key로 .apk를 여러 번 사인할 수 있음에 유의하라.
To verify that your .apk is signed, you can use a command like this:
여러분의 .apk가 사인되었는 지를 확인하기 위해, 여러분은 아래와 같은 명령어을 사용할 수 있다.
$ jarsigner -verify my_signed.apk
If the .apk is signed properly, Jarsigner prints "jar verified". If you want more details, you can try one of these commands:
만약 .apk가 제대로 사인되었다면, Jarsigner는 “jar verfied”라고 출력한다. 더 자세한 정보를 원한다면 아래 명령어 중의 하나를 시도해 볼 수 있다.
$ jarsigner -verify -verbose my_application.apk
or
또는
$ jarsigner -verify -verbose -certs my_application.apk
The command above, with the -certs option added, will show you the
"CN=" line that describes who created the key.
위의 명령어에 -certs 옵션이 추가되면, 여러분에게 누가 키key를 생성했는지를 설명하는 “CN=” 라인을 보여줄 것이다.
Note: If you see "CN=Android Debug", this means the .apk was signed with the debug key generated by the Android SDK. If you intend to release your application, you must sign it with your private key instead of the debug key.
Note: 만약 여러분이 “CN=Android Debug”를 보게 된다면, 이것은 .apk가 안드로이드 SDK가 생성한 디버그 키key로 사인되었음을 의미한다. 여러분의 애플리케이션을 릴리즈하고자 한다면, 디버그 키debyg key 대신 여러분의 개인 키private key로 사인해야만 한다.
For more information about Jarsigner, see the documentation at http://java.sun.com/j2se/1.5.0/docs/tooldocs/#security
Jarsigner에 대한 더 많은 정보에 대해서 http://java.sun.com/j2se/1.5.0/docs/tooldocs/#security를 보라.
Once you have signed the .apk with your private key, run zipalign on the file.
This tool ensures that all uncompressed data starts with a particular byte alignment,
relative to the start of the file. Ensuring alignment at 4-byte boundaries provides
a performance optimization when installed on a device. When aligned, the Android
system is able to read files with mmap(), even if
they contain binary data with alignment restrictions, rather than copying all
of the data from the package. The benefit is a reduction in the amount of
RAM consumed by the running application.
일단 여러분이 여러분의 개인 키로 .apk를 사인했다면, 그 파일에 대해서 zipalign을 수행하라. 이 도구는 모든 압축되지 않은 데이터가 그 파일의 시작으로부터 상대적으로 특정 바이트 얼라인먼트를 가지고 시작한다는 것을 보장한다. 4-바이트 경계에서 얼라인먼트를 보장하는 것은 패키지가 디바이스 상에 설치될 때 성능 최적화를 제공한다. 파일들이 얼라인먼트 제약을 가진 바이너리 데이터를 포함한다 할지라도 파일들이 얼라인될 때, 안드로이드 시스템은 패키지로부터 모든 데이터를 복사하기 보다는 mmap()을 사용해서 파일들을 읽을 수 있다.
The zipalign tool is provided with the Android SDK, inside the
tools/ directory. To align your signed .apk, execute:
zipalign 도구는 Android SDK와 함께 제공되며, tools/ 디렉토리안에 위치해 있다. 여러분의 사인된 .apk를 얼라인하기 위해 아래를 수행하라.
zipalign -v 4 your_project_name-unaligned.apk your_project_name.apk
The -v flag turns on verbose output (optional). 4 is the
byte-alignment (don't use anything other than 4). The first file argument is
your signed .apk (the input) and the second file is the destination .apk file (the output).
If you're overriding an existing .apk, add the -f flag.
-v 플래그는 verbose 출력(선택사항임)을 활성화한다. 4는 바이트-얼라인먼트이다. (4가 아닌 값을 사용하지 마라) 첫번째 파일인자는 여러분의 사인된 .apk(입력)이고 두번째 파일인자는 최종 .apk 파일(출력)이다. 여러분이 이미 존재하는 .apk를 오버라이드할 것이라면, -f 플래그를 추가하라.
Caution: Your input .apk must be signed with your
private key before you optimize the package with zipalign.
If you sign it after using zipalign, it will undo the alignment.
Caution: 여러분은 zipalign을 사용해서 패키지를 최적화하기 전에 여러분의 입력 .apk는 여러분의 개인 키를 가지고 사인되어야 한다. 만약 여러분이 zipalign을 사용한 후 패키지를 사인한다면, 패키지는 얼라인먼트 이전 상태로 돌아갈 것이다.
For more information, read about the zipalign tool.
더 많은 정보에 대해서는 zipalign 툴을 읽어라.
If you are using Eclipse with the ADT plugin, you can use the Export Wizard to
export a signed .apk (and even create a new keystore,
if necessary). The Export Wizard performs all the interaction with
the Keytool and Jarsigner for you, which allows you to sign the package using a GUI
instead of performing the manual procedures to compile, sign,
and align, as discussed above. Once the wizard has compiled and signed your package,
it will also perfom package alignment with zipalign.
Because the Export Wizard uses both Keytool and Jarsigner, you should
ensure that they are accessible on your computer, as described above
in the Basic Setup for Signing.
여러분이 ADT를 가진 이클립스를 사용한다면, 여러분은 사인된 .apk를 만들기 위해 Export 위저드를 사용할 수 있다(심지어 필요하다면 새로운 키스토어(keystore)를 생성할 수 있다). Export 위저드는 여러분을 위해 Keytool 및 Jarsigner와의 모든 상호작용을 수행한다. 이는 여러분으로 하여금 패키지를 컴파일하고 사인하고 얼라인하기 위해 수작업 절차를 수행하는 대신에 GUI를 이용하여 사인하도록 허용한다. 위저드가 일단 여러분의 패키지를 컴파일하고 사인하면, zipalign을 이용하여 패키지 얼라인먼트를 수행할 것이다. Export 위저드가 Keytool과 Jarsigner 모두를 사용하기 때문에, 여러분은 “사인을 위한 기본적 셋업”에서 위에 설명한 대로 여러분의 컴퓨터에서 그것들이 접근 가능하다는 것을 보장해야 한다.
To create a signed and aligned .apk in Eclipse:
이클립스에서 사인되고 얼라인된 .apk를 생성하기 위해,
The Export Android Application wizard now starts, which will guide you through the process of signing your application, including steps for selecting the private key with which to sign the .apk (or creating a new keystore and private key).
Export Android Application 위저드는 이제 시작하며, 이것은 (새로운 키스토어와 개인 키 생성 또는) .apk를 사인하기 위해 개인 키를 선택하는 과정들을 포함하여 여러분의 애플리케이션을 사인하는 과정을 통해 여러분을 안내해 줄 것이다.
Maintaining the security of your private key is of critical importance, both to you and to the user. If you allow someone to use your key, or if you leave your keystore and passwords in an unsecured location such that a third-party could find and use them, your authoring identity and the trust of the user are compromised.
여러분의 개인 키private key에 대한 안전을 유지하는 것은, 여러분과 사용자 모두에게 매우 중요하다. 만약 여러분의 키key를 다른 사람이 사용할 수 있도록 여러분의 키스토어keystore와 패스워드를 안전하지 않은 장소에 놓아 두어 제3자가 찾아서 사용할 수 있게 한다면 여러분의 제작 신원authoring identity과 사용자의 신뢰 모두 훼손된다.
If a third party should manage to take your key without your knowledge or permission, that person could sign and distribute applications that maliciously replace your authentic applications or corrupt them. Such a person could also sign and distribute applications under your identity that attack other applications or the system itself, or corrupt or steal user data.
만약 여러분의 인지 또는 승인없이 제3자가 여러분의 키key를 가지게 된다면, 그 사람은 여러분의 원래 애플리케이션을 악의적으로 바꾸고 오류를 발생시키는 애플리케이션을 사인해서 배포할 수 있다. 그 사람은 또한 다른 애플리케이션이나 시스템을 공격하거나 사용자 데이터에 오류를 일으키거나 그것을 훔치는 애플리케이션을 여러분의 신원identity으로 사인해서 배포할 수도 있다.
Your reputation as a developer entity depends on your securing your private key properly, at all times, until the key is expired. Here are some tips for keeping your key secure:
개발자로서 여러분의 명성은 여러분의 개인 키private key가 만료될 때까지 그 키를 언제나 올바르게 안전하게 하는 지에 달려있다. 여기에 여러분의 키key를 안전하게 하는 몇 가지 팁이 있다.
-storepass and -keypass options at the command line.
If you do so, your passwords will be available in your shell history,
which any user on your computer could access.-storepass and -keypass
options at the command line. In general, if you follow common-sense precautions when generating, using, and storing your key, it will remain secure.
일반적으로 여러분의 키key를 생성, 사용, 저장할 때, 상식 선의 주의사항들을 따른다면 키는 안전하게 유지될 것이다.