Skip to content

Commit

Permalink
Land #13148, reduce startup time by caching the android signing key
Browse files Browse the repository at this point in the history
  • Loading branch information
timwr committed Apr 1, 2020
2 parents 9704448 + fb06bc0 commit 90d4351
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/msf/core/payload/android.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ module Msf::Payload::Android
include Msf::Payload::TransportConfig
include Msf::Payload::UUID::Options

def signing_key
@@signing_key ||= OpenSSL::PKey::RSA.new(2048)
end

#
# Fix the dex header checksum and signature
# http://source.android.com/tech/dalvik/dex-format.html
Expand Down Expand Up @@ -69,7 +73,9 @@ def sign_jar(jar)
x509_name = OpenSSL::X509::Name.parse(
"C=US/O=Android/CN=Android Debug"
)
key = OpenSSL::PKey::RSA.new(2048)

key = signing_key

cert = OpenSSL::X509::Certificate.new
cert.version = 2
cert.serial = 1
Expand Down Expand Up @@ -134,6 +140,5 @@ def generate_jar(opts={})
jar
end


end

0 comments on commit 90d4351

Please sign in to comment.