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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:52:12+00:00 2026-05-27T21:52:12+00:00

Just a little background on my project: I’m implementing an SMS encryption program using

  • 0

Just a little background on my project:

I’m implementing an SMS encryption program using ECDH for Android (BouncyCastle) and I need to send my public keys over SMS. Functionality wise, all is up and working but I’m a little skeptical about the X.509 code I’ve implemented.

On the sender side:

        byte[] pubEnc = aKeyPair.getPublic().getEncoded();
        X509EncodedKeySpec  pubX509 = new X509EncodedKeySpec(pubEnc);

pubX509 is then encoded into Base64 and sent via SMS

On the receiver side:

        KeyFactory          keyFac = KeyFactory.getInstance("ECDH", "SC");
        X509EncodedKeySpec  pubX509 = new X509EncodedKeySpec(SharedS);
        ECPublicKey         pubKey = (ECPublicKey)keyFac.generatePublic(pubX509);

The received value is Base64 decoded into SharedS which is cast into a new pubX509

As I’ve mentioned, implementation wise, this code seems to be working fine, however I’d like to find out if I am implementing the X509 properly.

Any advise would be much appreciated.

  • 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-05-27T21:52:13+00:00Added an answer on May 27, 2026 at 9:52 pm

    The fact that Sun (now Oracle) called this an X509EncodedKeySpec is simply because the public key is encoded using a format that was specified in the much larger X.509 certificate standard. For the internet, a proper implementation of X.509 certificates is specified in RFC 5280. As you can see, this RFC is over 140 pages in length. In the whole document, these 3 lines describe how to represent a public key:

       SubjectPublicKeyInfo  ::=  SEQUENCE  {
            algorithm            AlgorithmIdentifier,
            subjectPublicKey     BIT STRING  }
    

    And this is format that is produced by the Java class X509EncodedKeySpec. You can ignore all the rest of the X509 standard, you don’t have to use certificates.

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

Sidebar

Related Questions

Just a little background: I am using Access 2010 to create forms and VBA
Just need a little bit of Javascript to warn people that press the back
I've just created a little app that programmatically compiles code using the C# Compiler,
My little brother is just getting into programming, and for his Science Fair project,
I've got a project where by I send email using PHP's inbuilt mail() function,
Background : I am currently using custom controls within my C# project (basic controls
For a little background: I am working on a project in C++ in which
A little background first as to why I need this. I am currently creating
Fist a little background: I'm using Rails 3.0.7, Postgres 9.0 and MetaWhere/MetaSearch 1.0.4 I
I have just 'inherited' a Java-project and not coming from a Java-background I am

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.