keystore - Genarate ECPublicKey in java -


hi new java ecc encryption.so got ecc public key data array java card.the size 49 byte length.so need genarate eccpublic key.so have created public key.but gives java.security.spec.invalidkeyspecexception: encoded key spec not recognised error.this code can me how generate eccpublickey using data array.thanks

byte[] pub = new byte[] {             /*(public data) 49 length byte array             */                };              system.out.println("length :" + pub.length);             x509encodedkeyspec ks = new x509encodedkeyspec(pub);              keyfactory kf;             try {                 kf = keyfactory.getinstance("ecdh");              } catch (nosuchalgorithmexception e) {                 e.printstacktrace();                 return;             }              ecpublickey remotepublickey;              try {                 remotepublickey = (ecpublickey) kf.generatepublic(ks);             } catch (invalidkeyspecexception e) {                 e.printstacktrace();                 return;             } catch (classcastexception e) {                 e.printstacktrace();                 return;             }             system.out.println(remotepublickey);          } catch (exception e) {             e.printstacktrace();         } 

the reason code not working keyspec can't use in ecc.so found how use ecpublickeyspec in ecc.in here has explanation.https://bitcointalk.org/index.php?topic=2899.0;wap2 thanks.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -