List of usage examples for org.apache.commons.codec.binary Base64 decodeBase64
public static byte[] decodeBase64(final byte[] base64Data)
From source file:com.streamsets.pipeline.stage.processor.statsaggregation.ConfigHelper.java
public static PipelineConfigurationJson readPipelineConfig(String pipelineConfigJson, Stage.Context context, List<Stage.ConfigIssue> issues) { PipelineConfigurationJson pipelineConfigurationJson = null; try {/*www . j a va 2 s. co m*/ pipelineConfigurationJson = ObjectMapperFactory.get().readValue( new String(Base64.decodeBase64(pipelineConfigJson)), PipelineConfigurationJson.class); } catch (IOException ex) { issues.add(context.createConfigIssue(Groups.STATS.getLabel(), "pipelineConfigJson", Errors.STATS_00, ex.getMessage(), ex)); } return pipelineConfigurationJson; }
From source file:com.enonic.cms.core.portal.instruction.PostProcessInstruction.java
public final void deserialize(String value) throws IOException, ClassNotFoundException { ByteArrayInputStream in = new ByteArrayInputStream(Base64.decodeBase64(value.getBytes())); ObjectInputStream din = new ObjectInputStream(in); readExternal(din);// w w w. ja v a 2 s .c o m in.close(); din.close(); }
From source file:com.liferay.sync.engine.lan.util.LanTokenUtil.java
public static String decryptLanToken(String lanTokenKey, String encryptedToken) throws Exception { byte[] bytes = DigestUtils.sha1(lanTokenKey); bytes = Arrays.copyOf(bytes, 16); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(bytes, "AES")); return new String(cipher.doFinal(Base64.decodeBase64(encryptedToken)), Charset.forName("UTF-8")); }
From source file:com.ebay.erl.mobius.util.SerializableUtil.java
public static Object deserializeFromBase64(String base64String, Configuration conf) throws IOException { ObjectInputStream ois = null; try {//from w w w .j a v a2 s . c o m byte[] objBinary = Base64.decodeBase64(base64String.getBytes()); ois = new ObjectInputStream(new ByteArrayInputStream(objBinary)); Object object = ois.readObject(); if (conf != null) { if (object instanceof Configurable) { ((Configurable) object).setConf(conf); } else if (object instanceof Configurable[]) { Configurable[] confArray = (Configurable[]) object; for (Configurable aConfigurable : confArray) { aConfigurable.setConf(conf); } } } return object; } catch (ClassNotFoundException e) { throw new RuntimeException(e); } finally { if (ois != null) { try { ois.close(); } catch (Throwable e) { } } } }
From source file:com.wx.serveplatform.common.utils.Encodes.java
/** * Base64?./* w w w .ja v a 2 s. c o m*/ */ public static String decodeBase64String(String input) { try { return new String(Base64.decodeBase64(input), DEFAULT_URL_ENCODING); } catch (UnsupportedEncodingException e) { return ""; } }
From source file:com.useekm.types.GeoWkbGz.java
@Override public Geometry getGeo() { return binaryToGeometry(gunzip(Base64.decodeBase64(getValue().getBytes()))); }
From source file:info.magnolia.cms.gui.control.Password.java
public String getHtml() { StringBuffer html = new StringBuffer(); String value = StringUtils.EMPTY; if (this.getEncoding() == ENCODING_BASE64) { // show number of characters (using spaces) String valueDecoded = new String(Base64.decodeBase64(this.getValue().getBytes())); for (int i = 0; i < valueDecoded.length(); i++) { value += " "; //$NON-NLS-1$ }//ww w . ja v a2 s .c om } else if (this.getEncoding() == ENCODING_UNIX) { value = StringUtils.EMPTY; } else { value = this.getValue(); } html.append("<input type=\"password\""); //$NON-NLS-1$ html.append(" name=\"" + this.getName() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ html.append(" id=\"" + this.getName() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ html.append(" value=\"" + value + "\""); //$NON-NLS-1$ //$NON-NLS-2$ html.append(getHtmlEvents()); html.append(this.getHtmlCssClass()); html.append(this.getHtmlCssStyles()); html.append(" />"); //$NON-NLS-1$ if (this.getSaveInfo()) { html.append(this.getHtmlSaveInfo()); } return html.toString(); }
From source file:com.db4o.sync4o.SyncKey.java
static public SyncKey fromEncodedString(String s) throws Exception { ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(Base64.decodeBase64(s.getBytes()))); SyncKey key = (SyncKey) ois.readObject(); ois.close();/* w w w . j a va 2 s .co m*/ return key; }
From source file:com.lwr.software.reporter.utils.EncryptionUtil.java
public static String decrypt(String encrypted) { try {// w w w . j a v a 2s. co m IvParameterSpec iv = new IvParameterSpec( DashboardConstants.INIT_VECTOR.getBytes(DashboardConstants.ENCODING)); SecretKeySpec skeySpec = new SecretKeySpec( DashboardConstants.INIT_KEY.getBytes(DashboardConstants.ENCODING), DashboardConstants.ALGORITHM); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING"); cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv); byte[] original = cipher.doFinal(Base64.decodeBase64(encrypted)); return new String(original); } catch (Exception ex) { ex.printStackTrace(); } return null; }
From source file:com.useekm.types.GeoWktGz.java
@Override public Geometry getGeo() { return wktToGeometry(new String(gunzip(Base64.decodeBase64(getValue().getBytes())))); }