@@ -834,7 +834,7 @@ public IRubyObject set_key(final ThreadContext context, final IRubyObject key) {
834
834
debugStackTrace (runtime , e );
835
835
throw newCipherError (runtime , e );
836
836
}
837
- if ( keyBytes .length () < keyLength ) {
837
+ if ( keyBytes .getRealSize () < keyLength ) {
838
838
throw newCipherError (context .runtime , "key length too short" );
839
839
}
840
840
@@ -856,7 +856,7 @@ public IRubyObject set_iv(final ThreadContext context, final IRubyObject iv) {
856
856
debugStackTrace (runtime , e );
857
857
throw newCipherError (runtime , e );
858
858
}
859
- if ( ivBytes .length () < ivLength ) {
859
+ if ( ivBytes .getRealSize () < ivLength ) {
860
860
throw newCipherError (context .runtime , "iv length too short" );
861
861
}
862
862
// EVP_CipherInit_ex uses leading IV length of given sequence.
@@ -1102,7 +1102,7 @@ public IRubyObject update(final ThreadContext context, final IRubyObject arg) {
1102
1102
checkAuthTag (runtime );
1103
1103
1104
1104
final ByteList data = arg .asString ().getByteList ();
1105
- final int length = data .length ();
1105
+ final int length = data .getRealSize ();
1106
1106
if ( length == 0 ) {
1107
1107
throw runtime .newArgumentError ("data must not be empty" );
1108
1108
}
@@ -1221,7 +1221,7 @@ private ByteList do_final_with_auth(final Ruby runtime) throws GeneralSecurityEx
1221
1221
final byte [] out ;
1222
1222
if ( auth_tag != null ) {
1223
1223
final byte [] tag = auth_tag .getUnsafeBytes ();
1224
- out = cipher .doFinal (tag , auth_tag .begin (), auth_tag .length ());
1224
+ out = cipher .doFinal (tag , auth_tag .getBegin (), auth_tag .getRealSize ());
1225
1225
}
1226
1226
else {
1227
1227
out = cipher .doFinal ();
@@ -1303,7 +1303,7 @@ private boolean updateAuthData(final Ruby runtime) {
1303
1303
if ( auth_data == null ) return false ; // only to be set if auth-mode
1304
1304
//try {
1305
1305
final byte [] data = auth_data .getUnsafeBytes ();
1306
- cipher .updateAAD (data , auth_data .begin (), auth_data .length ());
1306
+ cipher .updateAAD (data , auth_data .getBegin (), auth_data .getRealSize ());
1307
1307
//}
1308
1308
//catch (RuntimeException e) {
1309
1309
// debugStackTrace( runtime, e );
0 commit comments