retrieving the key in jce(java cyptography extension)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jatinch
    New Member
    • Mar 2010
    • 7

    retrieving the key in jce(java cyptography extension)

    i am implementing blowfish using jce (java cryptography extension )
    im generating the key using
    KeyGenerator keyGenerator = KeyGenerator.ge tInstance("Blow fish");

    keyGenerator.in it(128);

    SecretKey key = keyGenerator.ge nerateKey();
    now how do i retrieve the key so as to send it to another party or display it.. i have tried something and this is wat im getting : -

    System.out.prin tln("the key is" + key);
    o/p :- the key is javax.crypto.sp ec.SecretKeySpe c@d97af150

    i cant understand exactly whether the entire thing is the key or only @d97af150 is the key..
    and moreover
    when i try to encode it using
    System.out.prin tln("the key is" + key.getEncoded( ));
    this is what i get
    the key is [B@d24e3f
    so i dont know whether this is key or the initial thing is the key
    pls reply asap
    thanx..
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    Get the format of the key using getFormat. The name of the format should tell you what to do with it next. If you're stuck, post the results from using the getFormat method.

    Comment

    Working...