O'Reilly logo

Java Security by Scott Oaks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Class java.security.KeyFactory

Synopsis

A key factory is an engine class that is capable of translating between public or private key objects and their external format (and vice versa). Hence, key factories may be used to import or export keys, as well as to translate keys of one class (e.g., com.acme.DSAPublicKey) to another class (e.g., com.xyz.DSAPublicKeyImpl) as long as those classes share the same base class. Key factories operate in terms of key specifications; these specifications are the various external formats in which a key may be transmitted. Keys are imported via the generatePublic() and generatePrivate() methods, they are exported via the getKeySpec() method, and they are translated via the translateKey() method.

Class Definition

public class java.security.KeyFactory
	extends java.lang.Object {

	// Constructors
	protected KeyFactory(KeyFactorySpi, Provider, String);

	// Class Methods
	public static final KeyFactory getInstance(String);
	public static final KeyFactory getInstance(String, String);

	// Instance Methods
	public final PrivateKey generatePrivate(KeySpec);
	public final PublicKey generatePublic(KeySpec);
	public final String getAlgorithm();
	public final KeySpec getKeySpec(Key, Class);
	public final Provider getProvider();
	public final Key translateKey(Key);
}

See also:

KeyFactorySpi, KeySpec

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required