All Packages Class Hierarchy This Package Previous Next Index
Class java.security.PublicKey
java.lang.Object
|
+----java.security.Key
|
+----java.security.PublicKey
- public class PublicKey
- extends Key
A public key. The recommended format is X.509.
- See Also:
- Key, KeyParams, PrivateKey, Certificate, initVerify
-
PublicKey()
- Constructs an uninitialized public key for serialization.
-
PublicKey(byte[])
- Constructs a generic public key encoded using the X.509 format.
-
PublicKey(byte[], String)
- Constructs a public key encoded using a known format.
-
PublicKey(byte[], String, String)
- Constructs a public key, for a known algorithm, encoded using a
a known encoding format.
-
getClassName(String, String)
-
Given an algorithm name and the name of an encoding format, returns
the name of a PublicKey class using the specified format and
capable of handling keys for that algorithm.
-
getEncoded()
- Returns the encoded public key.
PublicKey
protected PublicKey()
- Constructs an uninitialized public key for serialization.
PublicKey
public PublicKey(byte encodedKey[])
- Constructs a generic public key encoded using the X.509 format.
PublicKey
public PublicKey(byte encodedKey[],
String format)
- Constructs a public key encoded using a known format.
- Parameters:
- encodedKey - the key, encoded using
format.
- format - the format used to encode the key.
PublicKey
public PublicKey(byte encodedKey[],
String format,
String algorithm)
- Constructs a public key, for a known algorithm, encoded using a
a known encoding format.
- Parameters:
- encodedKey - the key, encoded using
format.
- format - the format used to encode the key.
- algorithm - the name of the algorithm for this key.
getClassName
protected static String getClassName(String algName,
String format)
- Given an algorithm name and the name of an encoding format, returns
the name of a PublicKey class using the specified format and
capable of handling keys for that algorithm. The algorithm name
may be an alias or a standard name. See
algorithm names for
information about standard algorithm names. Note that the class may
not necessarily be accessible to a given caller.
- Parameters:
- algName - the algorithm name corresponding to the
class name requested.
- format - the requested encoding format.
getEncoded
public final byte[] getEncoded() throws InvalidKeyException
- Returns the encoded public key. Note that this method is public
since it's for public keys.
- Returns:
- the encoded public key.
- Throws: InvalidKeyException
- if the public key cannot be encoded,
for example if the original encoding was invalid, or if the key
was not properly initialized.
- Overrides:
- getEncoded in class Key
All Packages Class Hierarchy This Package Previous Next Index