func parseKeyArgs(args []string) ([]sec.PrivSignKey, uint8, error) {
	if len(args) == 0 {
		return nil, 0, nil
	}
	var keyId uint8
	var keyFilenames []string
	if len(args) == 1 {
		keyFilenames = append(keyFilenames, args[0])
	} else if useV1 {
		keyIdUint, err := strconv.ParseUint(args[1], 10, 8)
		if err != nil {
			return nil, 0, util.NewNewtError("Key ID must be between 0-255")
		}
		keyId = uint8(keyIdUint)
		keyFilenames = args[:1]
	} else {
		keyId = 0
		keyFilenames = args
	}
	keys, err := sec.ReadPrivSignKeys(keyFilenames)
	if err != nil {
		return nil, 0, err
	}
	return keys, keyId, nil
}
@return                      keys, key ID, error
package cli
import (
	"os"
	"strconv"
	"github.com/spf13/cobra"
	"github.com/apache/mynewt-artifact/image"
	"github.com/apache/mynewt-artifact/sec"
	"mynewt.apache.org/newt/newt/builder"
	"mynewt.apache.org/newt/newt/imgprod"
	"mynewt.apache.org/newt/newt/newtutil"
	"mynewt.apache.org/newt/util"
)
var useV1 bool
var useV2 bool
var useLegacyTLV bool
var encKeyFilename string
var encKeyIndex int
var hdrPad int
var imagePad int
var sections string