keyczar_ruby 0.3.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8cea43c1d58f723838191ff98378271b5f6bb01f
4
- data.tar.gz: 5a78d97b474e3479ef89e9e8dca27a762f5118fd
3
+ metadata.gz: 4128ff9d9472a15456f11f4bae702383fc84b94d
4
+ data.tar.gz: 632c43cd74f35ea3b3b3706be077dc69851625e7
5
5
  SHA512:
6
- metadata.gz: f2e5b90103b0891a95504fa589f846a5255fb0c9aeebe141ed4b20c7b31d46932b642bda76b7e65c115db788570003be4db6ffce609275b6a42f918733a97a2a
7
- data.tar.gz: f1077de2180349af0208320367268809b63aedcc456db8e3046e30e459cb7be3a60d1979b2d090fff52741902537ab588d8694c2533cd95b0dfcaa6823cf439f
6
+ metadata.gz: 372153f1b69ffe5814dd49f731877150621a6769b266b27b55a4414e35e894ec71c1299996baa94263ec9d2f28003c1c53e3155434944ff0669a7581f8256500
7
+ data.tar.gz: c95ea4c976d1018cd47c69d4aacec8d9c9e69351a66559269b2749069d2e7d252b96594dd908b6e18aa12786836e3e63c3478466158fb4efb912aaff6bfda469
@@ -42,21 +42,11 @@ extern "C" {
42
42
  static VALUE keyczar_encrypt(VALUE self, VALUE plaintext){
43
43
  keyczar::Crypter* crypter;
44
44
  Data_Get_Struct(self, keyczar::Crypter, crypter);
45
- crypter->set_compression(keyczar::Keyczar::NO_COMPRESSION);
46
45
 
47
- Check_Type(plaintext, T_STRING);
48
- std::string cryptext=crypter->Encrypt(RSTRING_PTR(plaintext));
49
-
50
- return rb_str_new2(cryptext.c_str());
51
- }
52
-
53
- static VALUE keyczar_encrypt_compressed(VALUE self, VALUE plaintext){
54
- keyczar::Crypter* crypter;
55
- Data_Get_Struct(self, keyczar::Crypter, crypter);
56
- crypter->set_compression(keyczar::Keyczar::GZIP);
46
+ std::string input(RSTRING_PTR(plaintext), RSTRING_LEN(plaintext));
57
47
 
58
48
  Check_Type(plaintext, T_STRING);
59
- std::string cryptext=crypter->Encrypt(RSTRING_PTR(plaintext));
49
+ std::string cryptext = crypter->Encrypt(input);
60
50
 
61
51
  return rb_str_new2(cryptext.c_str());
62
52
  }
@@ -64,22 +54,11 @@ extern "C" {
64
54
  static VALUE keyczar_decrypt(VALUE self, VALUE cryptext){
65
55
  keyczar::Crypter* crypter;
66
56
  Data_Get_Struct(self, keyczar::Crypter, crypter);
67
- crypter->set_compression(keyczar::Keyczar::NO_COMPRESSION);
68
-
69
- Check_Type(cryptext, T_STRING);
70
- std::string plaintext=crypter->Decrypt(RSTRING_PTR(cryptext));
71
- return rb_str_new2(plaintext.c_str());
72
- }
73
-
74
- static VALUE keyczar_decrypt_compressed(VALUE self, VALUE cryptext){
75
- keyczar::Crypter* crypter;
76
- Data_Get_Struct(self, keyczar::Crypter, crypter);
77
- crypter->set_compression(keyczar::Keyczar::GZIP);
78
57
 
79
58
  Check_Type(cryptext, T_STRING);
80
- std::string plaintext=crypter->Decrypt(RSTRING_PTR(cryptext));
59
+ std::string plaintext = crypter->Decrypt(RSTRING_PTR(cryptext));
81
60
 
82
- return rb_str_new2(plaintext.c_str());
61
+ return rb_str_new(plaintext.c_str(), plaintext.length());
83
62
  }
84
63
 
85
64
  static VALUE keyczar_sign(VALUE self, VALUE text){
@@ -109,9 +88,7 @@ extern "C" {
109
88
  c_Crypter = rb_define_class_under(m_Keyczar, "Crypter", rb_cObject);
110
89
 
111
90
  rb_define_method(c_Crypter, "encrypt", (ruby_method*) &keyczar_encrypt, 1);
112
- rb_define_method(c_Crypter, "encrypt_compressed", (ruby_method*) &keyczar_encrypt_compressed, 1);
113
91
  rb_define_method(c_Crypter, "decrypt", (ruby_method*) &keyczar_decrypt, 1);
114
- rb_define_method(c_Crypter, "decrypt_compressed", (ruby_method*) &keyczar_decrypt_compressed, 1);
115
92
 
116
93
  rb_define_method(c_Signer, "sign", (ruby_method*) &keyczar_sign, 1);
117
94
  rb_define_method(c_Signer, "verify", (ruby_method*) &keyczar_verify, 2);
@@ -1,3 +1,3 @@
1
1
  module Keyczar
2
- VERSION = "0.3.1"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keyczar_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - TrueCar SF Dev Team