diff options
Diffstat (limited to 'gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshKeyCreatorImpl.java')
-rw-r--r-- | gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshKeyCreatorImpl.java | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshKeyCreatorImpl.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshKeyCreatorImpl.java deleted file mode 100644 index 637f98edda..0000000000 --- a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshKeyCreatorImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (C) 2016 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.google.gerrit.sshd; - -import com.google.gerrit.common.errors.InvalidSshKeyException; -import com.google.gerrit.reviewdb.client.AccountSshKey; -import com.google.gerrit.server.ssh.SshKeyCreator; -import java.security.NoSuchAlgorithmException; -import java.security.NoSuchProviderException; -import java.security.spec.InvalidKeySpecException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class SshKeyCreatorImpl implements SshKeyCreator { - private static final Logger log = LoggerFactory.getLogger(SshKeyCreatorImpl.class); - - @Override - public AccountSshKey create(AccountSshKey.Id id, String encoded) throws InvalidSshKeyException { - try { - AccountSshKey key = new AccountSshKey(id, SshUtil.toOpenSshPublicKey(encoded)); - SshUtil.parse(key); - return key; - } catch (NoSuchAlgorithmException | InvalidKeySpecException e) { - throw new InvalidSshKeyException(); - - } catch (NoSuchProviderException e) { - log.error("Cannot parse SSH key", e); - throw new InvalidSshKeyException(); - } - } -} |