aesencrypt 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/aesencrypt.rb +32 -0
- metadata +45 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7634d7f5cbfce3f394e499974ef5fbd50cfb8bfb
|
4
|
+
data.tar.gz: 704af38271fb2f9c60036d0adbbe064f92907488
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cbf95e1c6965ede593bfe4be1e5d734e2e65afdce14b47d187bd7576e79210749744531fae46699731085cee0c94f8ffd8cbf712f71d9417a19df7b6e8ccd710
|
7
|
+
data.tar.gz: d2cbc43f994567942af7b713df4870b2ec0b88bd736cbd3ea3e240086d58117fe231ea94c162fb4d7773a2224859e9f146ae97d1156739dfc15ce37b508a657b
|
data/lib/aesencrypt.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
class AESEncrypt
|
3
|
+
|
4
|
+
require "base64"
|
5
|
+
require 'rubygems'
|
6
|
+
require 'openssl'
|
7
|
+
|
8
|
+
def self.aesEncrypt(key , data)
|
9
|
+
|
10
|
+
cipher = OpenSSL::Cipher::AES.new(128, :CFB)
|
11
|
+
cipher.encrypt
|
12
|
+
cipher.key = key
|
13
|
+
encrypted = cipher.update data
|
14
|
+
encoded = Base64.encode64(encrypted)
|
15
|
+
puts encoded
|
16
|
+
|
17
|
+
return encoded
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.aesDecrypt(key , data)
|
21
|
+
|
22
|
+
decoded = Base64.decode64(data)
|
23
|
+
cipher = OpenSSL::Cipher::AES.new(128, :CFB)
|
24
|
+
cipher.decrypt
|
25
|
+
cipher.key = key
|
26
|
+
decrypted = cipher.update(decoded)
|
27
|
+
puts decrypted
|
28
|
+
|
29
|
+
return decrypted
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aesencrypt
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adarsha
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-23 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple program for AES encryption and base 64 encoding
|
14
|
+
email: adarsha.shetty.89@live.in
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/aesencrypt.rb
|
20
|
+
homepage: http://rubygems.org/gems/aesencrypt
|
21
|
+
licenses:
|
22
|
+
- None
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.4.8
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: AES encryption and base 64 encoding gem
|
44
|
+
test_files: []
|
45
|
+
has_rdoc:
|