1# Copyright (C) 2022 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15import argparse 16import shlex 17 18 19def ParseSignerArgs(args): 20 if args is None: 21 return None 22 return shlex.split(args) 23 24 25def AddSigningArgumentParse(parser: argparse.ArgumentParser): 26 parser.add_argument('--package_key', type=str, 27 help='Paths to private key for signing payload') 28 parser.add_argument('--search_path', '--path', type=str, 29 help='Search path for framework/signapk.jar') 30 parser.add_argument('--payload_signer', type=str, 31 help='Path to custom payload signer') 32 parser.add_argument('--payload_signer_args', type=ParseSignerArgs, 33 help='Arguments for payload signer if necessary') 34 parser.add_argument('--payload_signer_maximum_signature_size', type=str, 35 help='Maximum signature size (in bytes) that would be ' 36 'generated by the given payload signer') 37 parser.add_argument('--private_key_suffix', type=str, 38 help='Suffix to be appended to package_key path', default=".pk8") 39