Uses of Interface java.security.PrivateKey (Java Platform SE 8 )
Date: 2026-01-21

## Uses of Interface
java.security.PrivateKey

- Packages that use PrivateKey
  Package | Description
  --- | ---
  java.security | Provides the classes and interfaces for the security framework.
  java.security.interfaces | Provides interfaces for generating RSA (Rivest, Shamir and Adleman AsymmetricCipher algorithm) keys as defined in the RSA Laboratory Technical Note PKCS#1, and DSA (Digital Signature Algorithm) keys as defined in NIST's FIPS-186.
  javax.crypto.interfaces | Provides interfaces for Diffie-Hellman keys as defined in RSA Laboratories' PKCS #3.
  javax.net.ssl | Provides classes for the secure socket package.
  javax.security.auth.x500 | This package contains the classes that should be used to store X500 Principal and X500 Private Credentials in a Subject.

- - ### Uses of PrivateKey in java.security

    Methods in java.security that return PrivateKey
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract PrivateKey` | KeyFactorySpi.`engineGeneratePrivate(KeySpec keySpec)` Generates a private key object from the provided key specification (key material).
    `PrivateKey` | KeyFactory.`generatePrivate(KeySpec keySpec)` Generates a private key object from the provided key specification (key material).
    `PrivateKey` | KeyPair.`getPrivate()` Returns a reference to the private key component of this key pair.
    `PrivateKey` | Signer.`getPrivateKey()` Deprecated. Returns this signer's private key.
    `PrivateKey` | KeyStore.PrivateKeyEntry.`getPrivateKey()` Gets the `PrivateKey` from this entry.

    Methods in java.security with parameters of type PrivateKey
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract void` | SignatureSpi.`engineInitSign(PrivateKey privateKey)` Initializes this signature object with the specified private key for signing operations.
    `protected void` | SignatureSpi.`engineInitSign(PrivateKey privateKey, SecureRandom random)` Initializes this signature object with the specified private key and source of randomness for signing operations.
    `void` | Signature.`initSign(PrivateKey privateKey)` Initialize this object for signing.
    `void` | Signature.`initSign(PrivateKey privateKey, SecureRandom random)` Initialize this object for signing.

    Constructors in java.security with parameters of type PrivateKey
    Constructor and Description
    `KeyPair(PublicKey publicKey, PrivateKey privateKey)` Constructs a key pair from the given public key and private key.
    `PrivateKeyEntry(PrivateKey privateKey, Certificate[] chain)` Constructs a `PrivateKeyEntry` with a `PrivateKey` and corresponding certificate chain.
    `PrivateKeyEntry(PrivateKey privateKey, Certificate[] chain, Set<KeyStore.Entry.Attribute> attributes)` Constructs a `PrivateKeyEntry` with a `PrivateKey` and corresponding certificate chain and associated entry attributes.
    `SignedObject(Serializable object, PrivateKey signingKey, Signature signingEngine)` Constructs a SignedObject from any Serializable object.

  - ### Uses of PrivateKey in java.security.interfaces

    Subinterfaces of PrivateKey in java.security.interfaces
    Modifier and Type | Interface and Description
    --- | ---
    `interface` | `DSAPrivateKey` The standard interface to a DSA private key.
    `interface` | `ECPrivateKey` The interface to an elliptic curve (EC) private key.
    `interface` | `RSAMultiPrimePrivateCrtKey` The interface to an RSA multi-prime private key, as defined in the PKCS#1 v2.2 standard, using the Chinese Remainder Theorem (CRT) information values.
    `interface` | `RSAPrivateCrtKey` The interface to an RSA private key, as defined in the PKCS#1 v2.2 standard, using the Chinese Remainder Theorem (CRT) information values.
    `interface` | `RSAPrivateKey` The interface to an RSA private key.

  - ### Uses of PrivateKey in javax.crypto.interfaces

    Subinterfaces of PrivateKey in javax.crypto.interfaces
    Modifier and Type | Interface and Description
    --- | ---
    `interface` | `DHPrivateKey` The interface to a Diffie-Hellman private key.

  - ### Uses of PrivateKey in javax.net.ssl

    Methods in javax.net.ssl that return PrivateKey
    Modifier and Type | Method and Description
    --- | ---
    `PrivateKey` | X509KeyManager.`getPrivateKey(String alias)` Returns the key associated with the given alias.

  - ### Uses of PrivateKey in javax.security.auth.x500

    Methods in javax.security.auth.x500 that return PrivateKey
    Modifier and Type | Method and Description
    --- | ---
    `PrivateKey` | X500PrivateCredential.`getPrivateKey()` Returns the PrivateKey.

    Constructors in javax.security.auth.x500 with parameters of type PrivateKey
    Constructor and Description
    `X500PrivateCredential(X509Certificate cert, PrivateKey key)` Creates an X500PrivateCredential that associates an X.509 certificate, a private key and the KeyStore alias.
    `X500PrivateCredential(X509Certificate cert, PrivateKey key, String alias)` Creates an X500PrivateCredential that associates an X.509 certificate, a private key and the KeyStore alias.

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.