Stay organized with collections
Save and categorize content based on your preferences.
PublicKey
public
interface
PublicKey
implements
Key
Known indirect subclasses
|
A public key. This interface contains no methods or constants.
It merely serves to group (and provide type safety for) all public key
interfaces.
Note: The specialized public key interfaces extend this interface.
See, for example, the DSAPublicKey interface in
java.security.interfaces
.
Summary
Constants |
long |
serialVersionUID
This constant was deprecated
in API level 34.
A serialVersionUID field in an interface is
ineffectual. Do not use; no replacement.
|
Inherited constants |
From interface
java.security.Key
long |
serialVersionUID
This constant was deprecated
in API level 34.
A serialVersionUID field in an interface is
ineffectual. Do not use; no replacement.
|
|
Inherited methods |
From interface
java.security.Key
abstract
String
|
getAlgorithm()
Returns the standard algorithm name for this key.
|
abstract
byte[]
|
getEncoded()
Returns the key in its primary encoding format, or null
if this key does not support encoding.
|
abstract
String
|
getFormat()
Returns the name of the primary encoding format of this key,
or null if this key does not support encoding.
|
|
Constants
serialVersionUID
public static final long serialVersionUID
This constant was deprecated
in API level 34.
A serialVersionUID
field in an interface is
ineffectual. Do not use; no replacement.
The class fingerprint that is set to indicate serialization
compatibility with a previous version of the class.
Constant Value:
7187392471159151072
(0x63bebf5f40c219e0)
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# PublicKey\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Constants](#constants) \\| [Inherited Constants](#inhconstants) \\| [Inherited Methods](#inhmethods) \n\nPublicKey\n=========\n\n\n`\npublic\n\n\ninterface\nPublicKey\n`\n\n\n`\n\n\nimplements\n\n`[Key](/reference/java/security/Key)`\n\n\n`\n\n|-------------------------|\n| java.security.PublicKey |\n\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known indirect subclasses [DHPublicKey](/reference/javax/crypto/interfaces/DHPublicKey), [DSAPublicKey](/reference/java/security/interfaces/DSAPublicKey), [ECPublicKey](/reference/java/security/interfaces/ECPublicKey), [EdECPublicKey](/reference/java/security/interfaces/EdECPublicKey), [RSAPublicKey](/reference/java/security/interfaces/RSAPublicKey), [XECPublicKey](/reference/java/security/interfaces/XECPublicKey) |--------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------| | [DHPublicKey](/reference/javax/crypto/interfaces/DHPublicKey) | The interface to a Diffie-Hellman public key. | | [DSAPublicKey](/reference/java/security/interfaces/DSAPublicKey) | The interface to a DSA public key. | | [ECPublicKey](/reference/java/security/interfaces/ECPublicKey) | The interface to an elliptic curve (EC) public key. | | [EdECPublicKey](/reference/java/security/interfaces/EdECPublicKey) | An interface for an elliptic curve public key as defined by [RFC 8032: Edwards-Curve Digital Signature Algorithm (EdDSA)](https://tools.ietf.org/html/rfc8032). | | [RSAPublicKey](/reference/java/security/interfaces/RSAPublicKey) | The interface to an RSA public key. | | [XECPublicKey](/reference/java/security/interfaces/XECPublicKey) | An interface for an elliptic curve public key as defined by RFC 7748. | |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\n\u003cbr /\u003e\n\nA public key. This interface contains no methods or constants.\nIt merely serves to group (and provide type safety for) all public key\ninterfaces.\n\nNote: The specialized public key interfaces extend this interface.\nSee, for example, the DSAPublicKey interface in\n`java.security.interfaces`. \n**See also:**\n\n- [Key](/reference/java/security/Key)\n- [PrivateKey](/reference/java/security/PrivateKey)\n- [Certificate](/reference/java/security/Certificate)\n- [Signature.initVerify(PublicKey)](/reference/java/security/Signature#initVerify(java.security.PublicKey))\n- [DSAPublicKey](/reference/java/security/interfaces/DSAPublicKey)\n- [RSAPublicKey](/reference/java/security/interfaces/RSAPublicKey)\n\nSummary\n-------\n\n| ### Constants ||\n|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `long` | [serialVersionUID](/reference/java/security/PublicKey#serialVersionUID) *This constant was deprecated in API level 34. A `serialVersionUID` field in an interface is ineffectual. Do not use; no replacement.* |\n\n| ### Inherited constants |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| From interface [java.security.Key](/reference/java/security/Key) |--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `long` | [serialVersionUID](/reference/java/security/Key#serialVersionUID) *This constant was deprecated in API level 34. A `serialVersionUID` field in an interface is ineffectual. Do not use; no replacement.* | |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From interface ` `[java.security.Key](/reference/java/security/Key)` ` |---------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract `[String](/reference/java/lang/String) | ` `[getAlgorithm](/reference/java/security/Key#getAlgorithm())`() ` Returns the standard algorithm name for this key. | | ` abstract byte[]` | ` `[getEncoded](/reference/java/security/Key#getEncoded())`() ` Returns the key in its primary encoding format, or null if this key does not support encoding. | | ` abstract `[String](/reference/java/lang/String) | ` `[getFormat](/reference/java/security/Key#getFormat())`() ` Returns the name of the primary encoding format of this key, or null if this key does not support encoding. | ||\n\nConstants\n---------\n\n### serialVersionUID\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nDeprecated in [API level\n34](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic static final long serialVersionUID\n```\n\n\n**This constant was deprecated\nin API level 34.** \n\nA `serialVersionUID` field in an interface is\nineffectual. Do not use; no replacement.\n\nThe class fingerprint that is set to indicate serialization\ncompatibility with a previous version of the class.\n\n\u003cbr /\u003e\n\nConstant Value:\n\n7187392471159151072\n(0x63bebf5f40c219e0)"]]