public DataStructure createStructureToRead() { return new Signature(); } }
/** * @param asn ASN.1 representation * @return a Signature with SigType type */ public static Signature fromJavaSig(byte[] asn, SigType type) throws SignatureException { // RSA and EdDSA sigs are not ASN encoded if (type.getBaseAlgorithm() == SigAlgo.RSA || type.getBaseAlgorithm() == SigAlgo.EdDSA) return new Signature(type, asn); return new Signature(type, aSN1ToSigBytes(asn, type.getSigLen())); }
public DataStructure createDataStructure() throws DataFormatException { Signature sig = new Signature(); byte data[] = new byte[Signature.SIGNATURE_BYTES]; for (int i = 0; i < data.length; i++) data[i] = (byte)(i%16); sig.setData(data); return sig; } public DataStructure createStructureToRead() { return new Signature(); }
/** * @return null on error or if not initialized or does not have offline keys * @since 0.9.38 */ public Signature getOfflineSignature() { if (_options == null || _destination == null) return null; String s = _options.getProperty(PROP_OFFLINE_SIGNATURE); if (s == null) return null; Signature rv = new Signature(_destination.getSigningPublicKey().getType()); try { rv.fromBase64(s); return rv; } catch (DataFormatException dfe) { return null; } }
/** * decrypt the signature (and subsequent pad bytes) with the * additional layer of encryption using the negotiated key along side * the packet's IV * * Caller must synch on this. * Only call this once! Decrypts in-place. */ private void decryptSignature() { if (_receivedEncryptedSignature == null) throw new NullPointerException("encrypted signature is null! this=" + this.toString()); if (_sessionKey == null) throw new NullPointerException("SessionKey is null!"); if (_receivedIV == null) throw new NullPointerException("IV is null!"); _context.aes().decrypt(_receivedEncryptedSignature, 0, _receivedEncryptedSignature, 0, _sessionKey, _receivedIV, _receivedEncryptedSignature.length); // handle variable signature size SigType type = _remotePeer.getSigningPublicKey().getType(); // if type == null throws NPE int sigLen = type.getSigLen(); int mod = sigLen % 16; if (mod != 0) { byte signatureBytes[] = new byte[sigLen]; System.arraycopy(_receivedEncryptedSignature, 0, signatureBytes, 0, sigLen); _receivedSignature = new Signature(type, signatureBytes); } else { _receivedSignature = new Signature(type, _receivedEncryptedSignature); } if (_log.shouldLog(Log.DEBUG)) _log.debug("Decrypted received signature: " + Base64.encode(_receivedSignature.getData())); }
public void readBytes(InputStream rawConfig) throws DataFormatException, IOException { _destination = Destination.create(rawConfig); _options = DataHelper.readProperties(rawConfig); _creationDate = DataHelper.readDate(rawConfig); _signature = new Signature(_destination.getSigningPublicKey().getType()); _signature.readBytes(rawConfig); }
Signature s; try { s = new Signature(type, sdata); } catch (IllegalArgumentException iae) { return false;
Signature s; try { s = new Signature(type, sdata); } catch (IllegalArgumentException iae) { return false;
Signature signature = new Signature();
/** * This does NOT validate the signature * * @throws IllegalStateException if called more than once or Destination already set */ @Override public void readBytes(InputStream in) throws DataFormatException, IOException { if (_signingKey != null) throw new IllegalStateException(); // LS2 header readHeader(in); // Encrypted LS2 part int encryptedSize = (int) DataHelper.readLong(in, 2); if (encryptedSize < MIN_ENCRYPTED_SIZE || encryptedSize > MAX_ENCRYPTED_SIZE) throw new DataFormatException("bad LS size: " + encryptedSize); _encryptedData = new byte[encryptedSize]; DataHelper.read(in, _encryptedData); // signature type depends on offline or not SigType type = isOffline() ? _transientSigningPublicKey.getType() : _signingKey.getType(); _signature = new Signature(type); _signature.readBytes(in); }
off += 4; DataHelper.toLong(signed, off, 4, _receivedSignedOnTime); Signature sig = new Signature(_receivedUnconfirmedIdentity.getSigType(), _receivedSignature); boolean ok = _context.dsa().verifySignature(sig, signed, _receivedUnconfirmedIdentity.getSigningPublicKey()); if (ok) {
_signature = new Signature(type); _signature.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); }
if (type == null) throw new DataFormatException("unsupported sig type"); rxSign = new Signature(type);
Signature s; try { s = new Signature(type, sdata); } catch (IllegalArgumentException iae) { return false;
/** * 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); }
_signature = new Signature(type); _signature.readBytes(in);
_signature = new Signature(type); _signature.readBytes(in);
_optionSignature = new Signature(type, _optionSignature.getData());
_transientSigningPublicKey = new SigningPublicKey(type); _transientSigningPublicKey.readBytes(destKeyStream); _offlineSignature = new Signature(dtype); _offlineSignature.readBytes(destKeyStream);