Top Description Inners Fields Constructors Methods
com.oracle.bmc.http.signing.internal

public Class PEMFileRSAPrivateKeySupplier

extends Object
implements KeySupplier<RSAPrivateKey>
Class Inheritance
All Implemented Interfaces
com.oracle.bmc.http.signing.internal.KeySupplier
Imports
com.oracle.bmc.http.client.InternalSdk, jakarta.annotation.Nonnull, .Nullable, java.io.IOException, .InputStream, java.security.interfaces.RSAPrivateKey, java.util.Optional

An implementation of KeySupplier that supplies a RSA private key from a PEM file. Supports PKCS#8 (starts with '-----BEGIN PRIVATE KEY-----' tag), PKCS#8 encrypted key (starts with '-----BEGIN ENCRYPTED PRIVATE KEY-----' tag) and PKCS#1 (i.e., starts with '-----BEGIN RSA PRIVATE KEY-----' tag) format.

Example commands that can be used to generate a 2048 bits RSA private key: $ openssl genrsa -out privateKey 2048

$ ssh-keygen -t rsa -b 2048

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final PEMStreamRSAPrivateKeySupplier
private static final Logger

Constructor Summary

AccessConstructor and Description
public
PEMFileRSAPrivateKeySupplier(final InputStream
the path to the RSA private key
inputStream
,
final char[]
the passphrase of the private key, optional
passphraseCharacters
)

Constructs a new file key supplier which reads the private key from the specified file.

Method Summary

Modifier and TypeMethod and Description
public Optional<RSAPrivateKey>

Returns:

an Optional for the key
supplyKey
(String
this parameter is ignored. The key returned is always the same, the one from the file.
ignored
)

Implements com.oracle.bmc.http.signing.internal.KeySupplier.supplyKey.

Get the key from the file.

public Optional<RSAPrivateKey>

Returns:

an Optional for the key
supplyKey
()

Get the key from the file.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

delegateback to summary
private final PEMStreamRSAPrivateKeySupplier delegate
LOGback to summary
private static final Logger LOG

Constructor Detail

PEMFileRSAPrivateKeySupplierback to summary
public PEMFileRSAPrivateKeySupplier(final InputStream inputStream, final char[] passphraseCharacters)

Constructs a new file key supplier which reads the private key from the specified file. The provided stream will be closed by this supplier automatically.

Parameters
inputStream:InputStream

the path to the RSA private key

passphraseCharacters:char[]

the passphrase of the private key, optional

Method Detail

supplyKeyback to summary
public Optional<RSAPrivateKey> supplyKey(String ignored)

Implements com.oracle.bmc.http.signing.internal.KeySupplier.supplyKey.

Get the key from the file.

Parameters
ignored:String

this parameter is ignored. The key returned is always the same, the one from the file.

Returns:Optional<RSAPrivateKey>

an Optional for the key

Annotations
@InternalSdk
backwardCompatibilityRequired:true
@Override
supplyKeyback to summary
public Optional<RSAPrivateKey> supplyKey()

Get the key from the file.

Returns:Optional<RSAPrivateKey>

an Optional for the key

Annotations
@InternalSdk
backwardCompatibilityRequired:true
@Nonnull
com.oracle.bmc.http.signing.internal back to summary

public Class PEMFileRSAPrivateKeySupplier.PEMFileRSAPrivateKeySupplierException

extends RuntimeException
Class Inheritance

An exception in the PEMFileRSAPrivateKeySupplier.

Constructor Summary

AccessConstructor and Description
public
public

Constructor Detail

PEMFileRSAPrivateKeySupplierExceptionback to summary
public PEMFileRSAPrivateKeySupplierException(String message, Throwable cause)
PEMFileRSAPrivateKeySupplierExceptionback to summary
public PEMFileRSAPrivateKeySupplierException(Throwable cause)