/** * Encodes a byte array into Base64 notation. * * @param source * The data to convert * @return encoded base64 representation of source. */ public static String encodeBytes(byte[] source) { return encodeBytes(source, 0, source.length); }
Digest(String hdr) { super(Type.DIGEST); params = parse(hdr); final String qop = params.get("qop"); //$NON-NLS-1$ if ("auth".equals(qop)) { //$NON-NLS-1$ final byte[] bin = new byte[8]; PRNG.nextBytes(bin); params.put("cnonce", Base64.encodeBytes(bin)); //$NON-NLS-1$ } }
@Override void configureRequest(HttpConnection conn) throws IOException { String ident = user + ":" + pass; //$NON-NLS-1$ String enc = Base64.encodeBytes(ident.getBytes(UTF_8)); conn.setRequestProperty(HDR_AUTHORIZATION, type.getSchemeName() + " " + enc); //$NON-NLS-1$ } }
final Mac m = Mac.getInstance(HMAC); m.init(privateKey); sec = Base64.encodeBytes(m.doFinal(s.toString().getBytes(UTF_8))); } catch (NoSuchAlgorithmException e) { throw new IOException(MessageFormat.format(JGitText.get().noHMACsupport, HMAC, e.getMessage()));
@Override OutputStream encrypt(OutputStream output) throws IOException { try { Cipher cipher = InsecureCipherFactory.create(cipherAlgo); cipher.init(Cipher.ENCRYPT_MODE, secretKey); AlgorithmParameters params = cipher.getParameters(); if (params == null) { context = EMPTY; } else { context = Base64.encodeBytes(params.getEncoded()); } return new CipherOutputStream(output, cipher); } catch (Exception e) { throw error(e); } }
final String md5str = Base64.encodeBytes(newMD5().digest(data)); final String lenstr = String.valueOf(data.length); for (int curAttempt = 0; curAttempt < maxAttempts; curAttempt++) {
@Override void configureRequest(HttpConnection conn) throws IOException { GSSManager gssManager = GSS_MANAGER_FACTORY.newInstance(conn .getURL()); String host = conn.getURL().getHost(); String peerName = "HTTP@" + host.toLowerCase(Locale.ROOT); //$NON-NLS-1$ try { GSSName gssName = gssManager.createName(peerName, GSSName.NT_HOSTBASED_SERVICE); GSSContext context = gssManager.createContext(gssName, OID, null, GSSContext.DEFAULT_LIFETIME); // Respect delegation policy in HTTP/SPNEGO. context.requestCredDeleg(true); byte[] token = context.initSecContext(prevToken, 0, prevToken.length); conn.setRequestProperty(HDR_AUTHORIZATION, getType().getSchemeName() + " " + Base64.encodeBytes(token)); //$NON-NLS-1$ } catch (GSSException e) { throw new IOException(e); } } }
monitorTask = MessageFormat.format(JGitText.get().progressMonUploading, key); final String md5str = Base64.encodeBytes(csum); final long len = buf.length(); for (int curAttempt = 0; curAttempt < maxAttempts; curAttempt++) {
/** * Encodes a byte array into Base64 notation. * * @param source * The data to convert * @return encoded base64 representation of source. */ public static String encodeBytes(byte[] source) { return encodeBytes(source, 0, source.length); }
/** * Encodes a byte array into Base64 notation. * * @param source * The data to convert * @return encoded base64 representation of source. */ public static String encodeBytes(byte[] source) { return encodeBytes(source, 0, source.length); }
private String encodeApiKey(String apiKey) throws IOException { return Base64.encodeBytes((":" + apiKey).getBytes()); } }
private String encodeApiKey(String apiKey) throws IOException { return Base64.encodeBytes((":" + apiKey).getBytes()); } }
Digest(String hdr) { super(Type.DIGEST); params = parse(hdr); final String qop = params.get("qop"); //$NON-NLS-1$ if ("auth".equals(qop)) { //$NON-NLS-1$ final byte[] bin = new byte[8]; PRNG.nextBytes(bin); params.put("cnonce", Base64.encodeBytes(bin)); //$NON-NLS-1$ } }
Digest(String hdr) { super(Type.DIGEST); params = parse(hdr); final String qop = params.get("qop"); //$NON-NLS-1$ if ("auth".equals(qop)) { //$NON-NLS-1$ final byte[] bin = new byte[8]; PRNG.nextBytes(bin); params.put("cnonce", Base64.encodeBytes(bin)); //$NON-NLS-1$ } }
@Override public String getToken() throws Exception { return getName() + ' ' + Base64.encodeBytes(token); }
private static void setupBasicAuth(String username, String password, HttpMessage message) { message.addHeader("Authorization", "Basic "+Base64.encodeBytes(new String(username+":"+password).getBytes())); }
@Override void configureRequest(final HttpConnection conn) throws IOException { String ident = user + ":" + pass; //$NON-NLS-1$ String enc = Base64.encodeBytes(ident.getBytes("UTF-8")); //$NON-NLS-1$ conn.setRequestProperty(HDR_AUTHORIZATION, type.getSchemeName() + " " + enc); //$NON-NLS-1$ } }
@Override void configureRequest(HttpConnection conn) throws IOException { String ident = user + ":" + pass; //$NON-NLS-1$ String enc = Base64.encodeBytes(ident.getBytes(UTF_8)); conn.setRequestProperty(HDR_AUTHORIZATION, type.getSchemeName() + " " + enc); //$NON-NLS-1$ } }
private String getHttpBasicAuthHeaderValue() { String authStr = config.getApiKey() + ":" + config.getApiSecret(); return "Basic " + Base64.encodeBytes(authStr.getBytes()); }
@Override OutputStream encrypt(OutputStream output) throws IOException { try { Cipher cipher = Cipher.getInstance(cipherAlgo); cipher.init(Cipher.ENCRYPT_MODE, secretKey); AlgorithmParameters params = cipher.getParameters(); if (params == null) { context = EMPTY; } else { context = Base64.encodeBytes(params.getEncoded()); } return new CipherOutputStream(output, cipher); } catch (Exception e) { throw error(e); } }