repository-secrets.rb
#First encrypts plain text input and then encodes in base64; returns cipher text
First encrypts plain text input and then encodes in base64; returns cipher text
First encrypts plain text input and then encodes in base64 ; returns cipher text
def encrypt(keypath, plaintext)
  verbose 3, "encrypt(\"#{keypath}\", \"#{plaintext}\")"
  public_key = OpenSSL::PKey::RSA.new(File.read(keypath))
  ciphertext = Base64.strict_encode64(public_key.public_encrypt(plaintext))
  verbose 3, "  returns \"#{ciphertext}\""
  return ciphertext
end
def encrypt ( keypath , plaintext ) verbose 3 , "encrypt(\"#{keypath}\", \"#{plaintext}\")" public_key = OpenSSL :: PKey :: RSA . new ( File . read ( keypath ) ) ciphertext = Base64 . strict_encode64 ( public_key . public_encrypt ( plaintext ) ) verbose 3 , "  returns \"#{ciphertext}\"" return ciphertext end
First encrypts plain text input and then encodes in base64; returns cipher text
First encrypts plain text input and then encodes in base64 ; returns cipher text
keypath
plaintext