cli/src/main/kotlin/org/jetbrains/zip/signer/ZipSigningTool.kt [80:110]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ) ) } private fun verify(params: Array) { val options = VerifyOptions() Args.parseOrExit(options, params) val certificateAuthority = CertificateUtils .loadCertificatesFromFile(File(options.certificateFile)) .first() when (val verificationResult = ZipVerifier.verify(File(options.inputFilePath))) { is SuccessfulVerificationResult -> if (!verificationResult.isSignedBy(certificateAuthority)) { exitWithError("Zip archive is not signed by provided certificate authority") } is MissingSignatureResult -> exitWithError("Provided zip archive is not signed") is InvalidSignatureResult -> exitWithError("Signature of zip archive is invalid") } } private fun exitWithError(message: String) { System.err.println(message) exitProcess(-1) } } class SigningOptions { @set:Argument("in", required = true, description = "Path to unsigned zip file") var inputFilePath: String = "" @set:Argument("out", required = true, description = "Path to signed zip file") var outputFilePath: String = "" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - google-kms-signer-cli/src/main/kotlin/org/jetbrains/zip/signer/GoogleCloudSignerCli.kt [68:98]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ) ) } private fun verify(params: Array) { val options = VerifyOptions() Args.parseOrExit(options, params) val certificateAuthority = CertificateUtils .loadCertificatesFromFile(File(options.certificateFile)) .first() when (val verificationResult = ZipVerifier.verify(File(options.inputFilePath))) { is SuccessfulVerificationResult -> if (!verificationResult.isSignedBy(certificateAuthority)) { exitWithError("Zip archive is not signed by provided certificate authority") } is MissingSignatureResult -> exitWithError("Provided zip archive is not signed") is InvalidSignatureResult -> exitWithError("Signature of zip archive is invalid") } } private fun exitWithError(message: String) { System.err.println(message) exitProcess(-1) } } class SigningOptions { @set:Argument("in", required = true, description = "Path to unsigned zip file") var inputFilePath: String = "" @set:Argument("out", required = true, description = "Path to signed zip file") var outputFilePath: String = "" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -