File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Security and the fly likes The Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "The "Key" interface." Watch "The "Key" interface." New topic
Forums: Java in General Security

The "Key" interface.

George Nowitzki

Joined: Apr 27, 2013
Posts: 1
Hello everyone,
i have to implement an encoding class, and i need a class that implements the Key interface. The problem is i don't really understand what exactly are the methods of that interface supposed to do. Can someone please explain to me what is a primary key encoding format for example? For example what would getFormat return for a One-Time-Pad encryption key? Thanks in advance!
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46412
Welcome to the Ranch

Sorry nobody seems to know the answer yet.
What is “Key”? Is it the same as this? In one of those methods, it appears simply to return the name of the algorithm, but I don’t know about the other two. I did some googling for tutorials and found several hits. I don’t know whether they are any good, but here are a few: 1 2 3.
This question is too difficult for “beginning”, so I shall try moving it to our security forum.
Mansukhdeep Thind
Ranch Hand

Joined: Jul 27, 2010
Posts: 1157

Yes Campbell, I believe he is talking about the interface. I myself have never come across the usage of this Interface. Maybe one of the less used features.

~ Mansukh
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
The Key class is used for for encryption, not encoding; is it the former or the latter that you want to implement? I'm asking because you use both terms.

But let's back up a bit: Why are you asking this question? Do you really need to create a class that implements Key? Or would an object suffice? If the latter, you can construct one using the SecretKeySpec class.
I agree. Here's the link:
subject: The "Key" interface.
It's not a secret anymore!