Skip to content

Commit e304196

Browse files
committed
payload: use correct option (pkcs and sha256) to sign the payload
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
1 parent 30800c6 commit e304196

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/update_engine/payload_processor_unittest.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ static void SignGeneratedShellPayload(SignatureTest signature_test,
211211
ScopedPathUnlinker sig_unlinker(sig_file);
212212
ASSERT_EQ(0,
213213
System(StringPrintf(
214-
"openssl rsautl -raw -sign -inkey %s -in %s -out %s",
214+
"openssl pkeyutl -sign -pkeyopt digest:sha256 -pkeyopt rsa_padding_mode:pkcs1 -inkey %s -in %s -out %s",
215215
private_key_path.c_str(),
216216
hash_file.c_str(),
217217
sig_file.c_str())));
@@ -222,7 +222,7 @@ static void SignGeneratedShellPayload(SignatureTest signature_test,
222222
signature_test == kSignatureGeneratedShellRotateCl2) {
223223
ASSERT_EQ(0,
224224
System(StringPrintf(
225-
"openssl rsautl -raw -sign -inkey %s -in %s -out %s",
225+
"openssl pkeyutl -sign -pkeyopt digest:sha256 -pkeyopt rsa_padding_mode:pkcs1 -inkey %s -in %s -out %s",
226226
kUnittestPrivateKey2Path,
227227
hash_file.c_str(),
228228
sig_file2.c_str())));

src/update_engine/payload_signer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ bool PayloadSigner::SignHash(const vector<char>& hash,
132132

133133
// This runs on the server, so it's okay to cop out and call openssl
134134
// executable rather than properly use the library
135-
vector<string> cmd = {"openssl", "rsautl", "-raw", "-sign",
135+
vector<string> cmd = {"openssl", "pkeyutl", "-sign", "-pkeyopt", "digest:sha256", "-pkeyopt", "rsa_padding_mode:pkcs1",
136136
"-inkey", private_key_path,
137137
"-in", hash_path,
138138
"-out", sig_path};

0 commit comments

Comments
 (0)