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 8200779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:34:06+00:00 2026-06-07T06:34:06+00:00

I am using the Android 4.1 Keychain and the following code worked fine under

  • 0

I am using the Android 4.1 Keychain and the following code worked fine under 4.0 but now gives me a Nullpointer exception (Cipher can’t read some internal attribute)

privateKey = KeyChain.getPrivateKey(context,mAlias);
byte[] data = // some biary data
Cipher rsasinger = javax.crypto.Cipher.getInstance("RSA/ECB/PKCS1PADDING");
rsasinger.init(Cipher.ENCRYPT_MODE, privkey);

byte[] signed_bytes = rsasinger.doFinal(data);

I am handling the private key from the KeyChain as opaque and simply use it with the java security Api. Do need I need to use the KeyChain API in a different way?

  • 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-07T06:34:08+00:00Added an answer on June 7, 2026 at 6:34 am

    After further debugging and by contacted by a Google engenier (Thanks!) it turned out that Android registers differents JAVA Crypto providers and only the OpenSSL Provider is able to use the PrivateKeys from the Keystore.

    But with some hacks and using /system/lib/ssl/engines/libkeystore.so it should be possible to work around this problem.

    See http://code.google.com/p/ics-openvpn/source/browse/jni/jbcrypto.cpp and proccessSignJellyBean in http://code.google.com/p/ics-openvpn/source/browse/src/de/blinkt/openvpn/OpenVpnManagementThread.java#446 for my solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using android 2.1 platform.The code I have will display the Name number
I currently using android NDK to write some native code in C. I have
When I take pictures using android.hardware.camera and I save them to the following location
i am using android:imeOptions=actionSearch in editText and my question is can i write my
Using Android TelephonyManager an application can obtain the state of data activity over the
Using android sdk 2.3. How can I synchronously update the UI from a service.
Now I am using: android:listSelector=@drawable/bg_list_item android:drawSelectorOnTop=true where bg_list_item.xml: <?xml version=1.0 encoding=utf-8?> <item android:state_selected=true> <shape
Am using android:configChanges=keyboardHidden|orientation for switching between portrait and landscape modes. But when user opens
I am using android 2.9 or something for my project. Now the project is
I'm using android 1.6 under windows 7 64bit when I call notifyDataSetChanged() from the

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.