Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8928181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:22:39+00:00 2026-06-15T08:22:39+00:00

trying to decrypt a base64 string for a login page and receive an error

  • 0

trying to decrypt a base64 string for a login page and receive an error “Input String is null”. Logcat points to line 55 and 139 but I am not sure how to recode it. I am novice with java and encryption but know the solution is simple. see logcat and decrypt class below.

Logcat:

11-12 04:51:49.273: W/System.err(22312): java.lang.NullPointerException: Input string was null.
11-12 04:51:49.273: W/System.err(22312):    at com.SharedPreferences.Login.Base64.decode(Base64.java:1243)
11-12 04:51:49.283: W/System.err(22312):    at com.SharedPreferences.Login.Base64.decode(Base64.java:1224)
11-12 04:51:49.283: W/System.err(22312):    at com.SharedPreferences.Login.AccessApp.decrypt(AccessApp.java:139)
11-12 04:51:49.293: W/System.err(22312):    at com.SharedPreferences.Login.AccessApp.onClick(AccessApp.java:55)
11-12 04:51:49.293: W/System.err(22312):    at android.view.View.performClick(View.java:3511)
11-12 04:51:49.293: W/System.err(22312):    at android.view.View$PerformClick.run(View.java:14105)
11-12 04:51:49.303: W/System.err(22312):    at android.os.Handler.handleCallback(Handler.java:605)
11-12 04:51:49.303: W/System.err(22312):    at android.os.Handler.dispatchMessage(Handler.java:92)
11-12 04:51:49.303: W/System.err(22312):    at android.os.Looper.loop(Looper.java:137)
11-12 04:51:49.303: W/System.err(22312):    at android.app.ActivityThread.main(ActivityThread.java:4424)
11-12 04:51:49.303: W/System.err(22312):    at java.lang.reflect.Method.invokeNative(Native Method)
11-12 04:51:49.313: W/System.err(22312):    at java.lang.reflect.Method.invoke(Method.java:511)
11-12 04:51:49.313: W/System.err(22312):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-12 04:51:49.313: W/System.err(22312):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-12 04:51:49.313: W/System.err(22312):    at dalvik.system.NativeStart.main(Native Method)

Decryption Class(AccessApp):

44. public void onClick(View arg0) {
45. 
46.   sp=this.getSharedPreferences("AccessApp", MODE_WORLD_READABLE);
47.   
48.    
49.    
50.    
51.   byte[] key = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 };
52.    
53.    
54.   try {
55.        String decryptedUser = decrypt(user, key);  
56.         user = sp.getString("USERNAME_KEY", decryptedUser);
57.          
58.   }
59. catch (Exception e) {
60.    // TODO Auto-generated catch block
61.   e.printStackTrace();
62.   }   
63.   try {
64.        String decryptedPass = decrypt(pass, key);  
65.        pass = sp.getString("PASSWORD_KEY", decryptedPass);
66.         
67.
68.   } catch (Exception e) {
69.     // TODO Auto-generated catch block
70.    e.printStackTrace();
71.   }
72.   
73.   if(lBttn.equals(arg0)){
74.     
75.      if((uname.getText().toString().equals(user))&& 
76.        (pword.getText().toString().equals(pass)))
77.       
78.            {
79.          Toast.makeText(this, "You are Logged In", 20000).show();
80.                 
81.               Intent intent;
82.                intent=new Intent(this,details.class);
83.                startActivity(intent);
84.              flag=1;
85.            }




135.         public static String decrypt(String encryptedText, byte[ ] key) throws Exception   {
136.    SecretKeySpec skeySpec = new SecretKeySpec(key, "AES");
137.    Cipher cipher = Cipher.getInstance("AES");
138.    cipher.init(Cipher.DECRYPT_MODE, skeySpec);
139.    byte[] toDecrypt = Base64.decode(encryptedText);
140.    byte[] encrypted = cipher.doFinal(toDecrypt);
141.    return new String(encrypted);
142.   }
143.  }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:22:40+00:00Added an answer on June 15, 2026 at 8:22 am

    If you have an encrypted username and a password stored in SharedPreferences you need to get the encoded version before you try to decode it.

    56.        user = sp.getString("USERNAME_KEY", null);
    55.        String decryptedUser = decrypt(user, key);
    ....
    65.        pass = sp.getString("PASSWORD_KEY", null);
    64.        String decryptedPass = decrypt(pass, key);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decrypt a string using mcrypt_decrypt, but I'm not sure how to
I am trying to decrypt the string ~9?8?m???=?T?G that I receive from a back-end
I am trying to encrypt and decrypt some simple text. But for some reason
Hi ive been trying to use System.Security.Cryptography to encrypt and decrypt a file but
I am trying to implement RSA encryption with Base64 encoding. The sequence is: String
I am trying to decrypt data using tripleDes. Everything looks fine but it has
I am trying to decrypt in JAVA a string that was encrypted in C#.
I'm getting literally crazy trying to decrypt in JavaScript a string encrypted in PHP
I am trying to encrypt a string using C# and decrypt it using Python.
I'm trying to take the base64 encrypted version of a file, decrypt it, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.