mirror of
https://github.com/rapid7/metasploit-payloads
synced 2025-01-02 11:36:22 +01:00
Pad encryption header to 64 bytes
This commit is contained in:
parent
93d467cd4a
commit
10caac0285
@ -2,10 +2,10 @@ require 'openssl'
|
||||
|
||||
module MetasploitPayloads
|
||||
module Crypto
|
||||
CIPHER_NAME = 'chacha20'.freeze
|
||||
IV = 'EncryptedPayload'.freeze # 16 bytes
|
||||
KEY = 'Rapid7MetasploitEncryptedPayload'.freeze # 32 bytes
|
||||
ENCRYPTED_PAYLOAD_HEADER = 'encrypted_payload_chacha20_v1'.freeze
|
||||
CIPHER_NAME = 'chacha20'.b.freeze
|
||||
IV = 'EncryptedPayload'.b.freeze # 16 bytes
|
||||
KEY = 'Rapid7MetasploitEncryptedPayload'.b.freeze # 32 bytes
|
||||
ENCRYPTED_PAYLOAD_HEADER = 'encrypted_payload_chacha20_v1'.ljust(64, '_').b.freeze
|
||||
|
||||
def self.encrypt(plaintext: '')
|
||||
raise ::ArgumentError, 'Unable to encrypt plaintext: ' << plaintext, caller unless plaintext.to_s
|
||||
@ -41,4 +41,4 @@ module MetasploitPayloads
|
||||
output
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -3,7 +3,7 @@ require 'metasploit-payloads'
|
||||
|
||||
RSpec.describe ::MetasploitPayloads::Crypto do
|
||||
describe '#encrypt' do
|
||||
let(:encrypted_header) { "encrypted_payload_chacha20_v1".b }
|
||||
let(:encrypted_header) { "encrypted_payload_chacha20_v1".ljust(64, '_').b }
|
||||
let(:plaintext) { "Hello World!".b }
|
||||
let(:ciphertext) { encrypted_header + "\\c\xB6N\x95\xE58\x8D\xDF\xBF4c".b }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user