/** * Decodes data from Base64 notation, automatically * detecting gzip-compressed data and decompressing it. * * @param s the string to decode * @return the decoded data * @throws java.io.IOException If there is a problem * @since 1.4 */ public static byte[] decode( String s ) throws java.io.IOException { return decode( s, NO_OPTIONS ); }
private byte[] getSaltyBytes() throws IOException { if (saltyBytes == null) { saltyBytes = Base64.decode(salt); } return saltyBytes; }
/** * Low-level access to decoding ASCII characters in * the form of a byte array. <strong>Ignores GUNZIP option, if * it's set.</strong> This is not generally a recommended method, * although it is used internally as part of the decoding process. * Special case: if len = 0, an empty array is returned. Still, * if you need more speed and reduced memory footprint (and aren't * gzipping), consider this method. * * @param source The Base64 encoded data * @return decoded data * @since 2.3.1 */ public static byte[] decode( byte[] source ) throws java.io.IOException { byte[] decoded = null; // try { decoded = decode( source, 0, source.length, Base64.NO_OPTIONS ); // } catch( java.io.IOException ex ) { // assert false : "IOExceptions only come from GZipping, which is turned off: " + ex.getMessage(); // } return decoded; }
/** * * @param digestAlgorithm * the used digest algorithm * @param base64Fingerprint * base64 encoded fingerprint data * * @throws IOException */ private FingerprintVerifier(String digestAlgorithm, String base64Fingerprint) throws IOException { this.digestAlgorithm = digestAlgorithm; // if the length is not padded with "=" chars at the end so that it is divisible by 4 the SSHJ Base64 implementation does not work correctly StringBuilder base64FingerprintBuilder = new StringBuilder(base64Fingerprint); while (base64FingerprintBuilder.length() % 4 != 0) { base64FingerprintBuilder.append("="); } fingerprintData = Base64.decode(base64FingerprintBuilder.toString()); }
byte[] objBytes = decode( encodedObject, options );
/** * Read and store the separate public key provided alongside the private key * * @param publicKey Public key accessible through a {@code Reader} */ private void initPubKey(Reader publicKey) throws IOException { final BufferedReader br = new BufferedReader(publicKey); try { final String keydata = br.readLine(); if (keydata != null) { String[] parts = keydata.trim().split(" "); assert parts.length >= 2; type = KeyType.fromString(parts[0]); pubKey = new Buffer.PlainBuffer(Base64.decode(parts[1])).readPublicKey(); } } finally { br.close(); } } }
bytes = decode( bytes, 0, bytes.length, options );
publicKey = Base64.decode(payload.get("Public-Lines")); if (this.isEncrypted()) { final char[] passphrase; privateKey = this.decrypt(Base64.decode(payload.get("Private-Lines")), new String(passphrase)); this.verify(new String(passphrase)); } finally { privateKey = Base64.decode(payload.get("Private-Lines"));
@Override protected KeyPair readKeyPair() throws IOException { BufferedReader reader = new BufferedReader(resource.getReader()); try { if (!checkHeader(reader)) { throw new IOException("This key is not in 'openssh-key-v1' format"); } String keyFile = readKeyFile(reader); byte[] decode = Base64.decode(keyFile); PlainBuffer keyBuffer = new PlainBuffer(decode); return readDecodedKeyPair(keyBuffer); } catch (GeneralSecurityException e) { throw new SSHRuntimeException(e); } finally { IOUtils.closeQuietly(reader); } }
throw new FormatException("PKCS5 header not found"); ASN1Data asn = new ASN1Data(data = decrypt(Base64.decode(sb.toString()), cipher, iv)); switch (type) { case RSA: {
final String sKey = split[i++]; try { byte[] keyBytes = Base64.decode(sKey); key = new Buffer.PlainBuffer(keyBytes).readPublicKey(); } catch (IOException ioe) {
private byte[] getSaltyBytes() throws IOException { if (saltyBytes == null) { saltyBytes = Base64.decode(salt); } return saltyBytes; }
private byte[] getSaltyBytes() throws IOException { if (saltyBytes == null) { saltyBytes = Base64.decode(salt); } return saltyBytes; }
/** * Decodes data from Base64 notation, automatically * detecting gzip-compressed data and decompressing it. * * @param s the string to decode * @return the decoded data * @throws java.io.IOException If there is a problem * @since 1.4 */ public static byte[] decode( String s ) throws java.io.IOException { return decode( s, NO_OPTIONS ); }
/** * Decodes data from Base64 notation, automatically detecting gzip-compressed data and decompressing it. * * @param s the string to decode * * @return the decoded data * * @throws java.io.IOException If there is a problem * @since 1.4 */ public static byte[] decode(String s) throws java.io.IOException { return decode(s, NO_OPTIONS); }
/** * * @param digestAlgorithm * the used digest algorithm * @param base64Fingerprint * base64 encoded fingerprint data * * @throws IOException */ private FingerprintVerifier(String digestAlgorithm, String base64Fingerprint) throws IOException { this.digestAlgorithm = digestAlgorithm; // if the length is not padded with "=" chars at the end so that it is divisible by 4 the SSHJ Base64 implementation does not work correctly StringBuilder base64FingerprintBuilder = new StringBuilder(base64Fingerprint); while (base64FingerprintBuilder.length() % 4 != 0) { base64FingerprintBuilder.append("="); } fingerprintData = Base64.decode(base64FingerprintBuilder.toString()); }
public static PublicKey parseOpenSSHKey(String line) throws IOException { String[] parts = line.split(" "); assert parts.length >= 2; return new net.schmizz.sshj.common.Buffer.PlainBuffer(decode(parts[1])).readPublicKey(); } }
public static PublicKey parseOpenSSHKey(String line) throws IOException { String[] parts = line.split(" "); assert parts.length >= 2; return new net.schmizz.sshj.common.Buffer.PlainBuffer(decode(parts[1])).readPublicKey(); } }
private static PublicKey getKey(String sKey) throws IOException { return new Buffer.PlainBuffer(Base64.decode(sKey)).readPublicKey(); }
@Override protected KeyPair readKeyPair() throws IOException { BufferedReader reader = new BufferedReader(resource.getReader()); try { if (!checkHeader(reader)) { throw new IOException("This key is not in 'openssh-key-v1' format"); } String keyFile = readKeyFile(reader); byte[] decode = Base64.decode(keyFile); PlainBuffer keyBuffer = new PlainBuffer(decode); return readDecodedKeyPair(keyBuffer); } catch (GeneralSecurityException e) { throw new SSHRuntimeException(e); } finally { IOUtils.closeQuietly(reader); } }