-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

Ren P
  • 929
  • 9
  • 20
  • 1
    How were they generated which format are they in (I don't mean hex)? – Artjom B. Mar 14 '15 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[]`. – EpicPandaForce Mar 14 '15 at 15:32
  • Doesn't look like RSA to me. – President James K. Polk Mar 16 '15 at 00:11
  • Me too. It was specified in the documentation, but doesn't look like a RSA key pair. – Marcos Supridatta Mar 16 '15 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). – President James K. Polk Mar 16 '15 at 23:43

2 Answers2

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.

-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.

dimm
  • 1,792
  • 11
  • 15