-1

Consider the following key pair:

Private: FC0EB454EAD538D54C36E1FB715D81F02410B832CB5AD9356C99306E3C65D856F7FB43BDBA3129C25758188E0F4751C58DAB9FA607C3ECC9D15A5D587C485265E20A3FF208F5FA5069AAB5C6371BD79507297F873F2B5511DA95D0E142C68CCBB58B7F45023845ACABFE1117FCDD5F99F6F92E9101AAECE0301CF5BA21A3D76B

Public: DE8F12BBEFBB6CBBC182717029E2ADCBC013AF2C078A1D7CCA6F07D6FBF0E2E0C2A04EF819BDD29334D5E3FFA7526271F3E000E4F5732203A6FBC1CEAD1F00958018A7D39FFA99914A938741838832DC15A380BE330561DB290E1F38A4FD997DA923542BB6338A78004B619756A26397B332471E7E8646B6B2F94F6A2ABC4337

Is there any way to load them as a private key and a public key respectively?

These keys were generated by a third-party software and I need to use it to encrypt some files.

Thank you in advance

5
  • 1
    How were they generated which format are they in (I don't mean hex)? Commented Mar 14, 2015 at 15:14
  • Hex.decode() might work from the BouncyCastle library to get it as a byte[], but it's a good question how to construct the KeyPair using byte[]. Commented Mar 14, 2015 at 15:32
  • Doesn't look like RSA to me. Commented Mar 16, 2015 at 0:11
  • Me too. It was specified in the documentation, but doesn't look like a RSA key pair. Commented Mar 16, 2015 at 17:24
  • The public key make sense as an RSA modulus; it isn't prime, but it also doesn't contain any small, easy to find, factors, and it is 1024 bits in size. But what's the public exponent? And the "private" component is the right size for the decrypt exponent, but it's larger than the presumed modulus. The RSA math still works for such a decrypt exponent, but I'm not aware of any software that produces a decrypt exponent that's larger than (p-1)*(q-1). Commented Mar 16, 2015 at 23:43

2 Answers 2

0

Sorry, my bad.

I did not quite understand a bad government documentation. In fact it was not possible to determine through public key of the private key with the same number of characters. The case was to use the module and the public exponent.

Sign up to request clarification or add additional context in comments.

Comments

-1

You can use the method parseHexBinary from the class DatatypeConverter to get the keys as byte array.

Then you need to use java crypto architecture to do the encryption.

1 Comment

You left out the interesting part.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.