/** * Reads an SSH string * * @return the string as a byte-array */ public byte[] readStringAsBytes() throws BufferException { return readBytes(); }
/** * Read an SSH multiple-precision integer * * @return the MP integer as a {@code BigInteger} */ public BigInteger readMPInt() throws BufferException { return new BigInteger(readBytes()); }
@SuppressWarnings("unchecked") static <T extends PublicKey> Certificate<T> readPubKey(Buffer<?> buf, KeyType innerKeyType) throws GeneralSecurityException { Certificate.Builder<T> builder = Certificate.getBuilder(); try { builder.nonce(buf.readBytes()); builder.publicKey((T) innerKeyType.readPubKeyFromBuffer(buf)); builder.serial(buf.readUInt64AsBigInteger()); builder.type(buf.readUInt32()); builder.id(buf.readString()); builder.validPrincipals(unpackList(buf.readBytes())); builder.validAfter(dateFromEpoch(buf.readUInt64())); builder.validBefore(dateFromEpoch(buf.readUInt64())); builder.critOptions(unpackMap(buf.readBytes())); builder.extensions(unpackMap(buf.readBytes())); buf.readString(); // reserved builder.signatureKey(buf.readBytes()); builder.signature(buf.readBytes()); } catch (Buffer.BufferException be) { throw new GeneralSecurityException(be); } return builder.build(); }
/** * Reads an SSH string * * @return the string as a byte-array */ public byte[] readStringAsBytes() throws BufferException { return readBytes(); }
/** * Reads an SSH string * * @return the string as a byte-array */ public byte[] readStringAsBytes() throws BufferException { return readBytes(); }
/** * Read an SSH multiple-precision integer * * @return the MP integer as a {@code BigInteger} */ public BigInteger readMPInt() throws BufferException { return new BigInteger(readBytes()); }
/** * Read an SSH multiple-precision integer * * @return the MP integer as a {@code BigInteger} */ public BigInteger readMPInt() throws BufferException { return new BigInteger(readBytes()); }
try { Buffer sigbuf = new Buffer.PlainBuffer(sig); final String algo = new String(sigbuf.readBytes()); if (!"ecdsa-sha2-nistp256".equals(algo)) { throw new SSHRuntimeException(String.format("Signature :: ecdsa-sha2-nistp256 expected, got %s", algo)); throw new SSHRuntimeException("Invalid key length"); r = sigbuf.readBytes(); s = sigbuf.readBytes(); } catch (Exception e) { throw new SSHRuntimeException(e);
@SuppressWarnings("unchecked") static <T extends PublicKey> Certificate<T> readPubKey(Buffer<?> buf, KeyType innerKeyType) throws GeneralSecurityException { Certificate.Builder<T> builder = Certificate.getBuilder(); try { builder.nonce(buf.readBytes()); builder.publicKey((T) innerKeyType.readPubKeyFromBuffer(buf)); builder.serial(buf.readUInt64AsBigInteger()); builder.type(buf.readUInt32()); builder.id(buf.readString()); builder.validPrincipals(unpackList(buf.readBytes())); builder.validAfter(dateFromEpoch(buf.readUInt64())); builder.validBefore(dateFromEpoch(buf.readUInt64())); builder.critOptions(unpackMap(buf.readBytes())); builder.extensions(unpackMap(buf.readBytes())); buf.readString(); // reserved builder.signatureKey(buf.readBytes()); builder.signature(buf.readBytes()); } catch (Buffer.BufferException be) { throw new GeneralSecurityException(be); } return builder.build(); }