Java Code Examples for org.apache.sshd.common.config.keys.KeyUtils#recoverPublicKey()
The following examples show how to use
org.apache.sshd.common.config.keys.KeyUtils#recoverPublicKey() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SshSetting.java From onedev with MIT License | 5 votes |
public String getFingerPrint() { try { PrivateKey privateKey = SshKeyUtils.decodePEMPrivateKey(pemPrivateKey); PublicKey publicKey = KeyUtils.recoverPublicKey(privateKey); return KeyUtils.getFingerPrint(BuiltinDigests.sha256, publicKey); } catch (IOException | GeneralSecurityException e) { throw new RuntimeException(e); } }
Example 2
Source File: SshSetting.java From onedev with MIT License | 5 votes |
public PublicKey getPublicKey() { try { return KeyUtils.recoverPublicKey(getPrivateKey()); } catch (GeneralSecurityException e) { throw new RuntimeException(e); } }
Example 3
Source File: DefaultKeyPairProvider.java From onedev with MIT License | 5 votes |
@Override public Iterable<KeyPair> loadKeys(SessionContext session) { SshSetting sshSetting = settingManager.getSshSetting(); try { PrivateKey privateKey = SshKeyUtils.decodePEMPrivateKey(sshSetting.getPemPrivateKey()); PublicKey publicKey = KeyUtils.recoverPublicKey(privateKey); return Lists.newArrayList(new KeyPair(publicKey, privateKey)); } catch (Exception e) { throw new RuntimeException(e); } }