generateSignature method

Future<File> generateSignature({
  1. required File manifest,
  2. String password = '12345',
})

Implementation

Future<File> generateSignature({
  required File manifest,
  String password = '12345',
}) async {
  if (!certPem.existsSync()) throw Exception('Missing cert.pem');
  if (!keyPem.existsSync()) throw Exception('Missing key.pem');

  final arguments = [
    '-in "${manifest.path}"',
    '-out "${signature.path}"',
    '-certfile "${wwdrPem.path}"',
    '-signer "${certPem.path}"',
    '-inkey "${keyPem.path}"',
    '-passin pass:$password',
    '-outform DER',
    '-binary',
    '-sign',
  ];

  await run('openssl smime ${arguments.join(' ')}');
  return signature;
}