Enhancement to present KeyPair.getKeyTypeString() method#259
Enhancement to present KeyPair.getKeyTypeString() method#259mwiede merged 1 commit intomwiede:masterfrom
Conversation
|
There's already a |
|
The key type only gives a coarse level type. ECDSA keys for example have an SSH name that includes the key size encoded in them. I find this useful to have in my use cases. Since it is already available I see no harm in the added public method. It does not cause any backwards compatibility issues as far as I know and it is a convenient property to have. |
|
If we're going to promote this as a public API method, I'd like to name it something better than How about naming it |
|
I appreciate your suggestion. I will make the change to the new name and see if the getKeyTypeName() wrapper works. I only used the I will also add Javadoc to the new method which I did not in the first revision. |
The package private method `getKeyTypeName()` is a convenient way to get the standard key name for SSH protocol keys. This method gives access to it as a String and makes it common to all KeyPair types.
e00b984 to
4b94250
Compare
The getSshName() method was available for most KeyPair implementations but inconsistently and not as part of the KeyPair class interface. This makes the method part of the KeyPair class interface and makes each implementation provide the correct value to the caller. I found this to be useful when importing keys from unknown files and expecting the KeyPair class to provide a hint as to the loaded key type in a way that can be used by code logic. I prefer this to doing class type inspection as it is much easier to get it right expecially for the ECDSA KeyPair which can have different SshName based on the key size.