Пример #1
0
        //string dname = "CN=Android Debug,O=Android,C=US";
        //keyalg = RSA and keyalg = 2048 for now
        public IProcessAsyncOperation Genkeypair(AndroidSigningOptions options, string dname, int validity,
                                                 TextWriter outputLog, TextWriter errorLog)
        {
            var args = new ProcessArgumentBuilder();

            args.Add("-genkeypair");
            args.Add("-alias");
            args.AddQuoted(options.KeyAlias);
            args.Add("-dname");
            args.AddQuoted(dname);
            args.Add("-storepass");
            args.AddQuoted(options.StorePass);
            args.Add("-keypass");
            args.AddQuoted(options.KeyPass);
            args.Add("-keystore");
            args.AddQuoted(options.KeyStore);
            args.Add("-keysize");
            args.Add("2048");
            args.Add("-keyalg");
            args.Add("RSA");
            if (validity > 0)
            {
                args.Add("-validity");
                args.AddQuoted(validity.ToString());
            }

            return(StartProcess(KeytoolExe, args.ToString(), outputLog, errorLog));
        }
Пример #2
0
        public MonoDroidPublishOperation(IProgressMonitor monitor, AndroidSigningOptions signingOptions,
                                         string sourceApk, string destinationApk, IAsyncOperation packagingOperation, bool createNewKey, string dName, int keyValidity)
        {
            var toolbox          = MonoDroidFramework.Toolbox;
            var destApk          = (FilePath)destinationApk;
            var destUnalignedApk = ((FilePath)(destApk.FileNameWithoutExtension + "-unaligned.apk"));

            if (!destApk.ParentDirectory.IsNullOrEmpty)
            {
                destUnalignedApk = destApk.ParentDirectory.Combine(destUnalignedApk);
            }

            chop = new ChainedAsyncOperationSequence(monitor,
                                                     new ChainedAsyncOperation()
            {
                TaskName = GettextCatalog.GetString("Creating new keystore"),
                Skip     = () => !createNewKey ? "" : null,
                Create   = () => toolbox.Genkeypair(signingOptions, dName,
                                                    keyValidity, monitor.Log, monitor.Log),
                ErrorMessage = GettextCatalog.GetString("Failed to create a new keystore")
            },
                                                     new ChainedAsyncOperation()
            {
                TaskName     = GettextCatalog.GetString("Waiting for packaging to complete"),
                Skip         = () => (packagingOperation == null || packagingOperation.IsCompleted) ? "" : null,
                Create       = () => packagingOperation,
                ErrorMessage = GettextCatalog.GetString("Failed to create android package")
            },
                                                     new ChainedAsyncOperation()
            {
                TaskName = GettextCatalog.GetString("Signing package with custom key"),
                Create   = () => toolbox.SignPackage(signingOptions, sourceApk, destUnalignedApk,
                                                     monitor.Log, monitor.Log),
                ErrorMessage = GettextCatalog.GetString("Failed to sign package")
            },
                                                     new ChainedAsyncOperation()
            {
                Create = () => toolbox.AlignPackage(destUnalignedApk, destApk,
                                                    monitor.Log, monitor.Log),
                ErrorMessage = GettextCatalog.GetString("Failed to align package")
            },
                                                     new ChainedAsyncOperation()
            {
                Create = () => {
                    File.Delete(destUnalignedApk);
                    return(Core.Execution.NullProcessAsyncOperation.Success);
                },
                ErrorMessage = GettextCatalog.GetString("Failed to remove temp package file")
            },
                                                     new ChainedAsyncOperation()
            {
                TaskName = GettextCatalog.GetString("Package successfully signed"),
                Create   = () => Core.Execution.NullProcessAsyncOperation.Success
            }
                                                     );
        }
Пример #3
0
        public IProcessAsyncOperation VerifyKeypair(AndroidSigningOptions options, TextWriter outputLog, TextWriter errorLog)
        {
            var args = new ProcessArgumentBuilder();

            args.Add("-list");
            args.Add("-keystore");
            args.AddQuoted(options.KeyStore);
            args.Add("-storepass");
            args.AddQuoted(options.StorePass);
            args.Add("-alias");
            args.AddQuoted(options.KeyAlias);

            return(StartProcess(KeytoolExe, args.ToString(), outputLog, errorLog));
        }
Пример #4
0
        public IProcessAsyncOperation SignPackage(AndroidSigningOptions options, string unsignedApk,
                                                  string signedApk, TextWriter outputLog, TextWriter errorLog)
        {
            var args = new ProcessArgumentBuilder();

            args.Add("-keystore");
            args.AddQuoted(options.KeyStore);
            args.Add("-storepass");
            args.AddQuoted(options.StorePass);
            args.Add("-keypass");
            args.AddQuoted(options.KeyPass);
            args.Add("-signedjar");
            args.AddQuoted(signedApk, unsignedApk, options.KeyAlias);

            return(StartProcess(JarsignerExe, args.ToString(), outputLog, errorLog));
        }
Пример #5
0
        public static MonoDroidPublishOperation PublishPackage(IProgressMonitor monitor, MonoDroidProject project,
                                                               ConfigurationSelector configSel, AndroidSigningOptions options, string sourceApk, string destApk,
                                                               bool createNewKey, string dName, int keyValidity)
        {
            var conf  = project.GetConfiguration(configSel);
            var opMon = new AggregatedOperationMonitor(monitor);

            IAsyncOperation packageOp = null;

            // If we need signing, it means we don't have the apk ready
            if (project.PackageNeedsSigning(configSel))
            {
                ClearUploadFlags(conf);
                packageOp = project.SignPackage(configSel);
                opMon.AddOperation(packageOp);
            }

            var outputMonitor = IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor(
                GettextCatalog.GetString("Publishing package"), MonoDevelop.Ide.Gui.Stock.RunProgramIcon, true, true);
            var op = new MonoDroidPublishOperation(outputMonitor, options, sourceApk, destApk, packageOp,
                                                   createNewKey, dName, keyValidity);

            op.Completed += delegate {
                opMon.Dispose();
                outputMonitor.Dispose();
            };
            op.Start();
            return(op);
        }
Пример #6
0
		public IProcessAsyncOperation SignPackage (AndroidSigningOptions options, string unsignedApk,
			string signedApk, TextWriter outputLog, TextWriter errorLog)
		{
			var args = new ProcessArgumentBuilder ();
			args.Add ("-keystore");
			args.AddQuoted (options.KeyStore);
			args.Add ("-storepass");
			args.AddQuoted (options.StorePass);
			args.Add ("-keypass");
			args.AddQuoted (options.KeyPass);
			args.Add ("-signedjar");
			args.AddQuoted (signedApk, unsignedApk, options.KeyAlias);
			
			return StartProcess (JarsignerExe, args.ToString (), outputLog, errorLog);
		}
Пример #7
0
		//string dname = "CN=Android Debug,O=Android,C=US";
		public IProcessAsyncOperation Genkeypair (AndroidSigningOptions options, string dname,
			TextWriter outputLog, TextWriter errorLog)
		{
			var args = new ProcessArgumentBuilder ();
			args.Add ("-genkeypair");
			args.Add ("-alias");
			args.AddQuoted (options.KeyAlias);
			args.Add ("-dname");
			args.AddQuoted (dname);
			args.Add ("-storepass");
			args.AddQuoted (options.StorePass);
			args.Add ("-keypass");
			args.AddQuoted (options.KeyPass);
			args.Add ("-keystore");
			args.AddQuoted (options.KeyStore);
			
			return StartProcess (KeytoolExe, args.ToString (), outputLog, errorLog);
		}