func init()

in cmd/sign_string.go [72:109]


func init() {
	rootCmd.AddCommand(signStringCmd)
	format = newEnum([]string{"json", "text", "bin"}, "json")
	digestArg = newEnum([]string{"SHA256", "SHA384", "SHA512"}, "SHA256")
	signStringCmd.PersistentFlags().StringVar(&certificateId, "certificate", "", "PKCS#11 URI to identify the certificate")
	signStringCmd.PersistentFlags().StringVar(&privateKeyId, "private-key", "", "Path to private key file or PKCS#11 URI to identify the private key")
	signStringCmd.PersistentFlags().BoolVar(&debug, "debug", false, "To print debug output")
	signStringCmd.PersistentFlags().StringVar(&certSelector, "cert-selector", "", "JSON structure to identify a certificate from a certificate store. "+
		"Can be passed in either as string or a file name (prefixed by \"file://\")")
	signStringCmd.PersistentFlags().StringVar(&systemStoreName, "system-store-name", "MY", "Name of the system store to search for within the "+
		"CERT_SYSTEM_STORE_CURRENT_USER context. Note that this flag is only relevant for Windows certificate stores and will be ignored otherwise")
	signStringCmd.PersistentFlags().BoolVar(&useLatestExpiringCertificate, "use-latest-expiring-certificate", false, "If multiple certificates match "+
		"a given certificate selector, the one that expires the latest will be chosen (if more than one still fits this criteria, an arbitrary "+
		"one is chosen from those that meet the criteria)")
	signStringCmd.PersistentFlags().StringVar(&libPkcs11, "pkcs11-lib", "", "Library for smart card / cryptographic device (default: p11-kit-proxy.{so, dll, dylib})")
	signStringCmd.PersistentFlags().BoolVar(&reusePin, "reuse-pin", false, "Use the CKU_USER PIN as the CKU_CONTEXT_SPECIFIC PIN for "+
		"private key objects, when they are first used to sign. If the CKU_USER PIN doesn't work as the CKU_CONTEXT_SPECIFIC PIN "+
		"for a given private key object, fall back to prompting the user")
	signStringCmd.PersistentFlags().StringVar(&tpmKeyPassword, "tpm-key-password", "", "Password for TPM key, if applicable")
	signStringCmd.PersistentFlags().BoolVar(&noTpmKeyPassword, "no-tpm-key-password", false, "Required if the TPM key has no password and"+
		"a handle is used to refer to the key")
	signStringCmd.PersistentFlags().Var(format, "format", "Output format. One of json, text, and bin")
	signStringCmd.PersistentFlags().Var(digestArg, "digest", "One of SHA256, SHA384, and SHA512")

	signStringCmd.MarkFlagsMutuallyExclusive("certificate", "cert-selector")
	signStringCmd.MarkFlagsMutuallyExclusive("certificate", "system-store-name")
	signStringCmd.MarkFlagsMutuallyExclusive("private-key", "cert-selector")
	signStringCmd.MarkFlagsMutuallyExclusive("private-key", "system-store-name")
	signStringCmd.MarkFlagsMutuallyExclusive("private-key", "use-latest-expiring-certificate")
	signStringCmd.MarkFlagsMutuallyExclusive("use-latest-expiring-certificate", "reuse-pin")
	signStringCmd.MarkFlagsMutuallyExclusive("cert-selector", "reuse-pin")
	signStringCmd.MarkFlagsMutuallyExclusive("system-store-name", "reuse-pin")
	signStringCmd.MarkFlagsMutuallyExclusive("tpm-key-password", "cert-selector")
	signStringCmd.MarkFlagsMutuallyExclusive("tpm-key-password", "reuse-pin")
	signStringCmd.MarkFlagsMutuallyExclusive("no-tpm-key-password", "cert-selector")
	signStringCmd.MarkFlagsMutuallyExclusive("no-tpm-key-password", "reuse-pin")
	signStringCmd.MarkFlagsMutuallyExclusive("no-tpm-key-password", "tpm-key-password")
}