diff options
author | Xavier Ducrohet <xav@android.com> | 2012-08-31 15:07:23 -0700 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2012-08-31 15:15:13 -0700 |
commit | 18142a38a2ba292aa3fc8b23479f53a5e5270a9c (patch) | |
tree | 10767fda843d482172586bdf1230e20736f409c6 /sdkmanager/libs | |
parent | b783ba0d7b4bc773abc78a9ea1cc3d519aa39cbd (diff) | |
download | sdk-18142a38a2ba292aa3fc8b23479f53a5e5270a9c.zip sdk-18142a38a2ba292aa3fc8b23479f53a5e5270a9c.tar.gz sdk-18142a38a2ba292aa3fc8b23479f53a5e5270a9c.tar.bz2 |
Remove obsolete stuff.
Change-Id: Ib3a4f7c0c479b4c8c7f2e27d47ba756969d4f0b4
Diffstat (limited to 'sdkmanager/libs')
-rw-r--r-- | sdkmanager/libs/sdklib/src/com/android/sdklib/internal/build/MakeIdentity.java | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/build/MakeIdentity.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/build/MakeIdentity.java deleted file mode 100644 index 955a81c..0000000 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/build/MakeIdentity.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.sdklib.internal.build; - -import com.android.appauth.Certificate; -import com.android.utils.ILogger; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.UnrecoverableEntryException; -import java.security.KeyStore.PrivateKeyEntry; -import java.security.cert.CertificateException; - -public class MakeIdentity { - - private final String mAccount; - private final String mKeystorePath; - private final String mKeystorePass; - private final String mAliasName; - private final String mAliasPass; - - /** - * Create a {@link MakeIdentity} object. - * @param account the google account - * @param keystorePath the path to the keystore - * @param keystorePass the password of the keystore - * @param aliasName the key alias name - * @param aliasPass the key alias password - */ - public MakeIdentity(String account, String keystorePath, String keystorePass, - String aliasName, String aliasPass) { - mAccount = account; - mKeystorePath = keystorePath; - mKeystorePass = keystorePass; - mAliasName = aliasName; - mAliasPass = aliasPass; - } - - /** - * Write the identity file to the given {@link PrintStream} object. - * @param ps the printstream object to write the identity file to. - * @return true if success. - * @throws KeyStoreException - * @throws NoSuchAlgorithmException - * @throws CertificateException - * @throws IOException - * @throws UnrecoverableEntryException - */ - public boolean make(PrintStream ps, ILogger log) - throws KeyStoreException, NoSuchAlgorithmException, - CertificateException, IOException, UnrecoverableEntryException { - - KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); - FileInputStream fis = new FileInputStream(mKeystorePath); - keyStore.load(fis, mKeystorePass.toCharArray()); - fis.close(); - PrivateKeyEntry entry = (KeyStore.PrivateKeyEntry)keyStore.getEntry( - mAliasName, new KeyStore.PasswordProtection(mAliasPass.toCharArray())); - - if (entry == null) { - return false; - } - - Certificate c = new Certificate(); - c.setVersion(Certificate.VERSION); - c.setType(Certificate.TYPE_IDENTITY); - c.setHashAlgo(Certificate.DIGEST_TYPE); - c.setPublicKey(entry.getCertificate().getPublicKey()); - c.setEntityName(mAccount); - c.signWith(c, entry.getPrivateKey()); - - /* sanity check */ - if (!c.isSignedBy(c)) { - System.err.println("signature failed?!"); - return false; - } - - /* write to the printstream object */ - try { - c.writeTo(ps); - } catch (Exception e) { - log.error(e, null); - } - - return true; - } -} |