File indexing completed on 2024-12-22 04:41:40
0001 /* 0002 * SPDX-FileCopyrightText: 2023 Albert Vaca Cintora <albertvaka@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 package org.kde.kdeconnect.Plugins.SftpPlugin; 0008 0009 import org.apache.sshd.common.NamedFactory; 0010 import org.apache.sshd.common.Signature; 0011 import org.apache.sshd.common.signature.AbstractSignature; 0012 0013 public class SignatureRSASHA256 extends AbstractSignature { 0014 0015 public static class Factory implements NamedFactory<Signature> { 0016 0017 public String getName() { 0018 return "rsa-sha2-256"; 0019 } 0020 0021 public Signature create() { 0022 return new SignatureRSASHA256(); 0023 } 0024 0025 } 0026 0027 public SignatureRSASHA256() { 0028 super("SHA256withRSA"); 0029 } 0030 0031 public byte[] sign() throws Exception { 0032 return signature.sign(); 0033 } 0034 0035 public boolean verify(byte[] sig) throws Exception { 0036 sig = extractSig(sig); 0037 return signature.verify(sig); 0038 } 0039 0040 }