Method: C3D::Encryptor#encrypt
- Defined in:
- lib/c3d/util/encrypt.rb
#encrypt(blob, recipients = []) ⇒ Object
encrypt will call gpg’s sign and encrypt function on a blob. by default encrypt will
sign and encrypt via the user's default keys. this function is opinionated and
has not been built to provide abstracted gpg encryption functionality. as such,
it will utilized gpg's built in rsa encryption functionality rather than using
elliptical curve functionality. over time, Project Douglas intends to the
scope of blob encryption . the blob argument passed to the encrypt function
can be either a file path or raw file contents as with the Blobber class as well as
the clearsign function. in addition, the function accepts an array of recipient email
addresses or gpg keys which can be used to restrict decryption functionality to the
intended recipients of the file blob only.
68 69 70 71 72 73 74 75 76 |
# File 'lib/c3d/util/encrypt.rb', line 68 def encrypt blob, recipients=[] clear_addendum blob = file_or_contents blob outf = add_output_path_to_opts add_recipients_to_opts recipients unless recipients.empty? cmd = build_command '--sign --encrypt', blob system "#{cmd}" return outf end |