Top Description Fields Constructors Methods
org.bouncycastle.crypto.util

public Class OpenSSHPublicKeyUtil

extends Object
Class Inheritance
Imports
java.io.IOException, java.math.BigInteger, org.bouncycastle.asn1.ASN1ObjectIdentifier, org.bouncycastle.asn1.x9.X9ECParameters, org.bouncycastle.crypto.params.AsymmetricKeyParameter, .DSAParameters, .DSAPublicKeyParameters, .ECNamedDomainParameters, .ECPublicKeyParameters, .Ed25519PublicKeyParameters, .RSAKeyParameters, org.bouncycastle.math.ec.ECCurve

OpenSSHPublicKeyUtil utility classes for parsing OpenSSH public keys.

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static byte[]

Returns:

the key OpenSSH encoded.
encodePublicKey
(AsymmetricKeyParameter
The key to encode.
cipherParameters
)

Encode a public key from an AsymmetricKeyParameter instance.

public static AsymmetricKeyParameter

Returns:

An AsymmetricKeyParameter instance.
parsePublicKey
(byte[]
The key.
encoded
)

Parse a public key.

public static AsymmetricKeyParameter

Returns:

A CipherParameters instance.
parsePublicKey
(SSHBuffer
containing the SSH public key.
buffer
)

Parse a public key from an SSHBuffer instance.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DSSback to summary
private static final String DSS
ECDSAback to summary
private static final String ECDSA
ED_25519back to summary
private static final String ED_25519
RSAback to summary
private static final String RSA

Constructor Detail

OpenSSHPublicKeyUtilback to summary
private OpenSSHPublicKeyUtil()

Method Detail

encodePublicKeyback to summary
public static byte[] encodePublicKey(AsymmetricKeyParameter cipherParameters) throws IOException

Encode a public key from an AsymmetricKeyParameter instance.

Parameters
cipherParameters:AsymmetricKeyParameter

The key to encode.

Returns:byte[]

the key OpenSSH encoded.

parsePublicKeyback to summary
public static AsymmetricKeyParameter parsePublicKey(byte[] encoded)

Parse a public key.

This method accepts the bytes that are Base64 encoded in an OpenSSH public key file.

Parameters
encoded:byte[]

The key.

Returns:AsymmetricKeyParameter

An AsymmetricKeyParameter instance.

parsePublicKeyback to summary
public static AsymmetricKeyParameter parsePublicKey(SSHBuffer buffer)

Parse a public key from an SSHBuffer instance.

Parameters
buffer:SSHBuffer

containing the SSH public key.

Returns:AsymmetricKeyParameter

A CipherParameters instance.