signingPublicKey.readBytes(fileInputStream); } catch (IOException ioe) { if (_log.shouldLog(Log.WARN))
@Test public void testShortRead() throws Exception{ SigningPublicKey publicKey = new SigningPublicKey(); ByteArrayInputStream in = new ByteArrayInputStream(DataHelper.getASCII("six times nine equals forty-two")); exception.expect(EOFException.class); exception.expectMessage("EOF after reading 31 bytes of " + SigningPublicKey.KEYSIZE_BYTES + " byte value"); publicKey.readBytes(in); } }
protected void readOfflineBytes(InputStream in) throws DataFormatException, IOException { _transientExpires = DataHelper.readLong(in, 4) * 1000; int itype = (int) DataHelper.readLong(in, 2); SigType type = SigType.getByCode(itype); if (type == null) throw new DataFormatException("Unknown sig type " + itype); _transientSigningPublicKey = new SigningPublicKey(type); _transientSigningPublicKey.readBytes(in); SigType stype = _destination.getSigningPublicKey().getType(); _offlineSignature = new Signature(stype); _offlineSignature.readBytes(in); }
/** * Overridden because we have a blinded key, not a dest */ @Override protected void readOfflineBytes(InputStream in) throws DataFormatException, IOException { _transientExpires = DataHelper.readLong(in, 4) * 1000; int itype = (int) DataHelper.readLong(in, 2); SigType type = SigType.getByCode(itype); if (type == null) throw new DataFormatException("Unknown sig type " + itype); _transientSigningPublicKey = new SigningPublicKey(type); _transientSigningPublicKey.readBytes(in); SigType stype = _signingKey.getType(); _offlineSignature = new Signature(stype); _offlineSignature.readBytes(in); }
_signingKey = new SigningPublicKey(type); _signingKey.readBytes(in); int numLeases = in.read(); if (numLeases > MAX_LEASES)
/** * Overridden because we have a blinded key, not a dest */ @Override protected void readHeader(InputStream in) throws DataFormatException, IOException { int stype = (int) DataHelper.readLong(in, 2); SigType type = SigType.getByCode(stype); if (type == null) throw new DataFormatException("unknown key type " + stype); _signingKey = new SigningPublicKey(type); _signingKey.readBytes(in); _published = DataHelper.readLong(in, 4) * 1000; _expires = _published + (DataHelper.readLong(in, 2) * 1000); _flags = (int) DataHelper.readLong(in, 2); if (isOffline()) readOfflineBytes(in); }
pubkey.readBytes(fis); SigningPublicKey signingPubKey = new SigningPublicKey(); signingPubKey.readBytes(fis);
throw new DataFormatException("Unsupported transient sig type: " + itype); _transientSigningPublicKey = new SigningPublicKey(type); _transientSigningPublicKey.readBytes(destKeyStream); _offlineSignature = new Signature(dtype); _offlineSignature.readBytes(destKeyStream);