EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Exception when run Proguard android build

Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.
Posted: 05/06/2016 06:49:00
by headerit it (Standard support level)
Joined: 01/24/2014
Posts: 6


We want to use SB library on our android app, so I downloaded package for android and build test app.

But when run Proguard script I get below exception.
Can anyone tell me about this exception and how to fix it.

This is exception:

Unexpected error while performing partial evaluation:
Class = [SecureBlackbox/Base/EPlConvError]
Method = [<init>(ZLSecureBlackbox/Base/IPlCharset;Ljava/lang/String;)V]
Exception = [java.lang.ArrayIndexOutOfBoundsException] (-1)
Error: -1

Best regards,
Posted: 05/06/2016 07:08:14
by Eugene Mayevski (EldoS Corp.)

Does your code work without Proguard?

Sincerely yours
Eugene Mayevski
Posted: 05/06/2016 20:53:38
by headerit it (Standard support level)
Joined: 01/24/2014
Posts: 6

Yes, when I run in eclipse, it work well.
I'm not use this method in my code too.

Best regards,
Bui Si Tuan
Posted: 05/09/2016 04:24:12
by Eugene Mayevski (EldoS Corp.)

I am a bit confused. Does the error happen in Proguard when you try to process SecureBlackbox assemblies with it OR the error happens when you run the protected program?

Sincerely yours
Eugene Mayevski
Posted: 05/09/2016 05:08:31
by headerit it (Standard support level)
Joined: 01/24/2014
Posts: 6

I think it happen when script Proguard try to optimize SB.
When I add option -dontoptimize in proguard.txt, this exception is gone.

Best regards,
Bui Si Tuan
Posted: 05/10/2016 03:20:12
by headerit it (Standard support level)
Joined: 01/24/2014
Posts: 6


With option -dontoptimize, I fixed previous problem.
But I get new exception and I don't know how to fix it

This is stacktrace:

Attempt to invoke virtual method 'java.lang.reflect.Method java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])' on a null object reference
org.freepascal.rtl.FpcBaseProcVarType: setFpcBaseProcVarTypeBySignature() line[-1]
org.freepascal.rtl.FpcBaseProcVarType: <init>() line[-1]
SecureBlackbox.Base.TCharsetLibraryRegProc: <init>() line[-1]
SecureBlackbox.Base.SBChSConv: initCharsets() line[893]
SecureBlackbox.Base.TPlConverter: <init>() line[1994]
SecureBlackbox.Base.TPlConverter: <init>() line[1989]
SecureBlackbox.Base.TElUnicodeConverter: <init>() line[136]
SecureBlackbox.Base.SBUnicode: createUnicodeStringConverter() line[106]
SecureBlackbox.Base.SBStrUtils: createGlobalStringConverter() line[829]
SecureBlackbox.Base.SBStrUtils: getGlobalStringConverter() line[846]
SecureBlackbox.Base.SBStrUtils: utf8ToStr() line[3030]
SecureBlackbox.Base.SBUtils: processKey() line[17585]
SecureBlackbox.Base.SBUtils: setLicenseKey() line[17841]
SecureBlackbox.Base.SBUtils: setLicenseKey() line[17893]
com.bkav.bkavcrypto.xml.XMLSignature: sign() line[34]

And this is my method:

* @param input
* @return
public static String sign(String input) {
String result = "";
String keystoreData = "<base64keystoredata>";
String keystorePass = "<keystorepassword>";
SBUtils.setLicenseKey("<LICENSE in license.txt>");
TElXAdESSigner XAdESSigner = null;
TElXMLSigner Signer;

byte[] data = Base64Utils.base64Decode(input);
ByteArrayInputStream inStream = new ByteArrayInputStream(data);
TElStream stream = new TElMemoryStream(inStream);

XAdESSigner = new TElXAdESSigner();
Signer = new TElXMLSigner();
try {
TElXMLDOMDocument XMLDocument = new TElXMLDOMDocument();

TElXMLReferenceList TElXMLListInstance = new TElXMLReferenceList();
TElXMLReference Ref = new TElXMLReference();
Ref.setDigestMethod((short) 1);
.add(new TElXMLEnvelopedSignatureTransform());

Signer.setCanonicalizationMethod((short) 2);
Signer.setSignatureMethod((short) 2);
Signer.setSignatureType((short) 4);
Signer.setSignatureMethodType((short) 0);

TElXMLKeyInfoX509Data X509Data = new TElXMLKeyInfoX509Data(true);
TElX509Certificate Certificado = new TElX509Certificate();
ByteArrayInputStream keyInStream = new ByteArrayInputStream(
Certificado.loadFromStreamPFX(keyInStream,keystorePass, 0);



TElMemoryStream out = new TElMemoryStream();
byte[] signed = out.toByteArray();
result = Base64Utils.base64Encode(signed);
} finally {

return result;
Posted: 05/10/2016 04:01:43
by Vsevolod Ievgiienko (EldoS Corp.)

Most likely internal java.lang.Class.getDeclaredMethod call tries to call some method by its name, but this name is obfuscated using ProGuard. I think the best option is to remove SecureBlackbox JARs from ProGuard input list.
Posted: 05/10/2016 07:36:18
by headerit it (Standard support level)
Joined: 01/24/2014
Posts: 6

Thanks for your help,
I think it come from some class in SecureBlackbox.Base.* where you pass method name as parameter.

It can be a constant field in somewhere, if you can tell me it's type, then I can add option in Proguard script and I think my problem will be solved.

Best regards,
Bui Si Tuan
Posted: 05/11/2016 05:11:57
by Vsevolod Ievgiienko (EldoS Corp.)

The call stack points to compiler's RTL classes, so there will be a lot of places where methods are called this way. Its better to exclude all SecureBlackbox JARs from ProGuard input list.
Posted: 05/11/2016 21:46:02
by headerit it (Standard support level)
Joined: 01/24/2014
Posts: 6

Thanks for your help,

Yes I think it is not best solution but it working now.

Best regards,
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.



Topic viewed 2811 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!