
Security News
MCP Steering Committee Launches Official MCP Registry in Preview
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
The sym-crypt
core library offers simple wrappers around OpenSSL with the following features:
AES-256-cBC
, which is the standard Cipher used by the US GovernmentAES-128-CBC
Cipher.This library is a "wrapper" that allows you to take advantage of the
symmetric encryption functionality provided by the {OpenSSL} gem (and the
underlying C library). In order to use the library in your ruby classes, you
should include the module Sym::Crypt
.
Any class that includes Sym::Crypt
is decorated with four instance methods [:encr, :decr, :encr_password, :decr_password]
, and three class methods [:create_private_key, :private_key, :private_key=]
.
In the example below, we read a previously generated key from the environment variable. The key must be stored away from the data for obvious reasons.
require 'sym/crypt'
class TopSecret
include Sym::Crypt
# read the key from environmant variable and assign to this class.
private_key ENV['PRIVATE_KEY']
def sensitive_value=(value)
@sensitive_value = encr(value, self.class.private_key)
end
def sensitive_value
decr(@sensitive_value, self.class.private_key)
end
end
In this example we encrypt sensitive value with a provided password. Password must not be nil or blank.
require 'sym/crypt'
class SensitiveStuff < Struct.new(:password)
include Sym::Crypt
def sensitive_value=(value)
@sensitive_value = encr_password(value, password)
end
def sensitive_value
decr_password(@sensitive_value, password)
end
end
You can create a new key within any class that includes Sym::Crypt
by calling the #create_private_key
class method, which returns a new key every time it's called.
Classes that include Sym::Crypt
are also decorated with a class instance variable @private_key
and corresponding accessors #private_key
and #private_key=
. The writer assigns the key passed via the argument, while the reader returns a previously assigned key, or creates a new one, and assigns it. Subsequent calls will, thus, return the same key as the first call.
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
.
To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/kigster/sym-crypt
sym and sym-crypt library is © 2016-2017 Konstantin Gredeskoul.
The gem is available as open source under the terms of the MIT License. The library is designed to be a layer on top of OpenSSL
, distributed under the Apache Style license.
Contributions of any kind are very much welcome from anyone.
Any pull requests will be reviewed promptly.
Please submit feature requests, bugs, or donations :)
Konstantin Gredeskoul (primary developer)
Barry Anderson (sanity checking, review)
FAQs
Unknown package
We found that sym-crypt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.