comparison src/com/five_ten_sg/connectbot/service/AuthAgentService.java @ 296:8c55d7714d03 ganymed

start conversion from trilead to ganymed
author Carl Byington <carl@five-ten-sg.com>
date Tue, 29 Jul 2014 16:35:48 -0700
parents 91a31873c42a
children c1f929cb3dd0
comparison
equal deleted inserted replaced
295:deb5fb087b6f 296:8c55d7714d03
88 return sshEncodedSignatureFor(data, (RSAPrivateKey) privKey); 88 return sshEncodedSignatureFor(data, (RSAPrivateKey) privKey);
89 } 89 }
90 else if (privKey instanceof DSAPrivateKey) { 90 else if (privKey instanceof DSAPrivateKey) {
91 return sshEncodedSignatureFor(data, (DSAPrivateKey) privKey); 91 return sshEncodedSignatureFor(data, (DSAPrivateKey) privKey);
92 } 92 }
93 else if (privKey instanceof ECPrivateKey) {
94 return sshEncodedSignatureFor(data, (ECPrivateKey) privKey);
95 }
93 96
94 return null; 97 return null;
95 } 98 }
96 private void waitForTerminalManager() throws RemoteException { 99 private void waitForTerminalManager() throws RemoteException {
97 lock.lock(); 100 lock.lock();
134 } 137 }
135 else if (privKey instanceof DSAPrivateKey) { 138 else if (privKey instanceof DSAPrivateKey) {
136 DSAPublicKey pubkey = (DSAPublicKey)pair.getPublic(); 139 DSAPublicKey pubkey = (DSAPublicKey)pair.getPublic();
137 return DSASHA1Verify.encodeSSHDSAPublicKey(pubkey); 140 return DSASHA1Verify.encodeSSHDSAPublicKey(pubkey);
138 } 141 }
142 else if (privKey instanceof ECPrivateKey) {
143 ECPublicKey pubkey = (ECPublicKey) pair.getPublic();
144 return ECDSASHA2Verify.encodeSSHECDSAPublicKey(pubkey);
145 }
139 } 146 }
140 catch (IOException e) { 147 catch (IOException e) {
141 Log.e(TAG, "Couldn't encode " + pair, e); 148 Log.e(TAG, "Couldn't encode " + pair, e);
142 } 149 }
143 150
159 } 166 }
160 catch (IOException e) { 167 catch (IOException e) {
161 throw new RuntimeException(e); 168 throw new RuntimeException(e);
162 } 169 }
163 } 170 }
171 private byte[] sshEncodedSignatureFor(byte[] data, ECPrivateKey privKey) {
172 try {
173 byte[] signature = ECDSASHA2Verify.generateSignature(data, privKey);
174 return ECDSASHA2Verify.encodeSSHECDSASignature(signature);
175 }
176 catch (IOException e) {
177 throw new RuntimeException(e);
178 }
179 }
164 private KeyPair keyPairFor(byte[] publicKey) { 180 private KeyPair keyPairFor(byte[] publicKey) {
165 String nickname = manager.getKeyNickname(publicKey); 181 String nickname = manager.getKeyNickname(publicKey);
166 182
167 if (nickname == null) { 183 if (nickname == null) {
168 Log.w(TAG, "No key-pair found for public-key."); 184 Log.w(TAG, "No key-pair found for public-key.");