@Override public DSAPublicKey construct(byte[] data, byte[] headers, byte[] routingKey, byte[] fullKey, boolean canReadClientCache, boolean canReadSlashdotCache, BlockMetadata meta, DSAPublicKey ignored) throws KeyVerifyException { if(data == null) throw new PubkeyVerifyException("Need data to construct pubkey"); try { return DSAPublicKey.create(data); } catch (CryptFormatException e) { throw new PubkeyVerifyException(e); } }
/** @return True unless the pubkey is broken and we should try another node */ private boolean handleSSKPubKey(Message msg, PeerNode next) { if(logMINOR) Logger.minor(this, "Got pubkey on "+uid); byte[] pubkeyAsBytes = ((ShortBuffer)msg.getObject(DMT.PUBKEY_AS_BYTES)).getData(); try { if(pubKey == null) pubKey = DSAPublicKey.create(pubkeyAsBytes); ((NodeSSK)key).setPubKey(pubKey); return true; } catch (SSKVerifyException e) { pubKey = null; Logger.error(this, "Invalid pubkey from "+source+" on "+uid+" ("+e.getMessage()+ ')', e); int t = timeSinceSent(); node.failureTable.onFailed(key, next, htl, t, t); next.noLongerRoutingTo(origTag, false); return false; // try next node } catch (CryptFormatException e) { Logger.error(this, "Invalid pubkey from "+source+" on "+uid+" ("+e+ ')'); int t = timeSinceSent(); node.failureTable.onFailed(key, next, htl, t, t); next.noLongerRoutingTo(origTag, false); return false; // try next node } }
identity = SHA256.digest(DSAPublicKey.create(sfs, Global.DSAgroupBigA).asBytes());
pubKey = DSAPublicKey.create(((ShortBuffer)pk.getObject(DMT.PUBKEY_AS_BYTES)).getData()); } catch (CryptFormatException e) { Logger.error(this, "Bogus pubkey from "+pn+" for offer for "+key+" : "+e, e);
byte[] pubkeyAsBytes = ((ShortBuffer)msg.getObject(DMT.PUBKEY_AS_BYTES)).getData(); try { pubKey = DSAPublicKey.create(pubkeyAsBytes); if(logMINOR) Logger.minor(this, "Got pubkey on "+uid+" : "+pubKey); Message confirm = DMT.createFNPSSKPubKeyAccepted(uid);