/** * Sign a message and base64 encode the signature. */ public String sign(String msg) { try { RSAPrivateKey key = getPrivateKey(); Signature sig = Signature.getInstance(SIGNING_ALGORITHM + "with" + key.getAlgorithm()); sig.initSign(key); sig.update(msg.getBytes("UTF-8")); return hudson.remoting.Base64.encode(sig.sign()); } catch (GeneralSecurityException e) { throw new SecurityException(e); } catch (UnsupportedEncodingException e) { throw new AssertionError(e); // UTF-8 is mandatory } }
/** * Sign a message and base64 encode the signature. */ public String sign(String msg) { try { RSAPrivateKey key = getPrivateKey(); Signature sig = Signature.getInstance(SIGNING_ALGORITHM + "with" + key.getAlgorithm()); sig.initSign(key); sig.update(msg.getBytes("UTF-8")); return hudson.remoting.Base64.encode(sig.sign()); } catch (GeneralSecurityException e) { throw new SecurityException(e); } catch (UnsupportedEncodingException e) { throw new AssertionError(e); // UTF-8 is mandatory } }
public String getKey() { return key.getAlgorithm() + " " + Base64.encode(key.getKey()); }
public String getKey() { return key.getAlgorithm() + " " + Base64.encode(key.getKey()); }
if (slaveJnlpCredentials != null) { String userPassword = slaveJnlpCredentials; String encoding = Base64.encode(userPassword.getBytes("UTF-8")); http.setRequestProperty("Authorization", "Basic " + encoding); String encoding = Base64.encode(System.getProperty("proxyCredentials", proxyCredentials).getBytes("UTF-8")); http.setRequestProperty("Proxy-Authorization", "Basic " + encoding);
@Override public String getInjectedKey() throws IOException { InstanceIdentity id = InstanceIdentity.get(); return "ssh-rsa " + encode(new RSAKeyAlgorithm().encodePublicKey(id.getPublic())); }
public void testSingleWrite() throws IOException { byte[] ds = getDataSet(65536); String master = Base64.encode(ds); ByteArrayOutputStream buf = new ByteArrayOutputStream(); OutputStream o = BinarySafeStream.wrap(buf); o.write(ds,0,ds.length); o.close(); assertEquals(buf.toString(),master); }
final String encodedScan; try { encodedScan = Base64.encode(artifact.readToString().getBytes(StandardCharsets.UTF_8)); } catch (IOException | InterruptedException e) { logger.log(Messages.Builder_Error_Processing() + ": " + e.getMessage());
public void testChunkedWrites() throws IOException { byte[] ds = getDataSet(65536); String master = Base64.encode(ds); Random r = new Random(0); for( int i=0; i<16; i++) { ByteArrayOutputStream buf = new ByteArrayOutputStream(); OutputStream o = BinarySafeStream.wrap(buf); randomCopy(r,new ByteArrayInputStream(ds),o,false); assertEquals(buf.toString(),master); } }
String content = Util.replaceMacro(userDataText, resolver); LOGGER.fine("Sending user-data:\n" + content); builder.userData(Base64.encode(content.getBytes(Charsets.UTF_8)));