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 +4 -4
- data/ext/keyczar_ruby/keyczar_ruby.cc +4 -27
- data/lib/keyczar_ruby/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4128ff9d9472a15456f11f4bae702383fc84b94d
|
4
|
+
data.tar.gz: 632c43cd74f35ea3b3b3706be077dc69851625e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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(
|
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
|
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);
|
data/lib/keyczar_ruby/version.rb
CHANGED