public static String encode64(byte[] secret, String cipherAlgorithm, SecretKey cipherKey, PBEParameterSpec cipherSpec) throws Exception { byte[] encoding = encode(secret, cipherAlgorithm, cipherKey, cipherSpec); String b64 = Base64.encodeBytes(encoding); return b64; }
/** * Get the Custom Stax Source to DOM result transformer that has been written to get over the JDK transformer bugs (JDK6) as * well as the issue of Xalan installing its Transformer (which does not support stax). * * @return * @throws ConfigurationException */ public static Transformer getStaxSourceToDomResultTransformer() throws ConfigurationException { return new PicketLinkStaxToDOMTransformer(); }
/** * Given a comma separated string, get the tokens as a {@link List} * * @param str * @return */ public static List<String> tokenize(String str) { return tokenize(str, ","); }
public void write(SAML11ActionType action) throws ProcessingException { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, SAML11Constants.ACTION, ns); String ns = action.getNamespace(); if (StringUtil.isNotNull(ns)) { StaxUtil.writeAttribute(writer, SAML11Constants.NAMESPACE, ns); } String val = action.getValue(); if (StringUtil.isNotNull(val)) { StaxUtil.writeCharacters(writer, val); } StaxUtil.writeEndElement(writer); }
/** * Encodes a byte array into Base64 notation. Does not GZip-compress data. * * @param source The data to convert * @return the encode bytes * @since 1.4 */ public static String encodeBytes(byte[] source) { return encodeBytes(source, 0, source.length, NO_OPTIONS); } // end encodeBytes
public static String decode64(String secret, String cipherAlgorithm, SecretKey cipherKey, PBEParameterSpec cipherSpec) throws GeneralSecurityException, UnsupportedEncodingException { byte[] encoding = Base64.decode(secret); byte[] decode = decode(encoding, cipherAlgorithm, cipherKey, cipherSpec); return new String(decode, "UTF-8"); }
/** * Serializes an object and returns the Base64-encoded version of that serialized object. If the object cannot be serialized * or there is another error, the method will return <tt>null</tt>. The object is not GZip-compressed before being encoded. * * @param serializableObject The object to encode * @return The Base64-encoded object * @since 1.4 */ public static String encodeObject(java.io.Serializable serializableObject) { return encodeObject(serializableObject, NO_OPTIONS); } // end encodeObject
/** * Use the transformer to transform * * @param transformer * @param stax * @param result * * @throws ParsingException */ public static void transform(Transformer transformer, StAXSource stax, DOMResult result) throws ParsingException { transform(transformer, (Source) stax, result); }
/** * Log the nodes in the document * * @param doc */ public static void logNodes(Document doc) { visit(doc, 0); }
/** * Get the System Property * @param key key of the system property * @param defaultValue default value to be returned if the system property is not set * @return */ public static String getSystemProperty(final String key, final String defaultValue){ return SecurityActions.getSystemProperty(key,defaultValue); } }
/** * Suspends encoding of the stream. May be helpful if you need to embed a piece of base640-encoded data in a stream. * * @since 1.5.1 * @throws IOException */ public void suspendEncoding() throws java.io.IOException { flushBase64(); this.suspendEncoding = true; } // end suspendEncoding
public static String encode64(byte[] secret, String cipherAlgorithm, SecretKey cipherKey, PBEParameterSpec cipherSpec) throws Exception { byte[] encoding = encode(secret, cipherAlgorithm, cipherKey, cipherSpec); String b64 = Base64.encodeBytes(encoding); return b64; }
/** * Encodes a byte array into Base64 notation. Does not GZip-compress data. * * @param source The data to convert * @param off Offset in array where conversion should begin * @param len Length of data to convert * @return the text node * @since 1.4 */ public static String encodeBytes(byte[] source, int off, int len) { return encodeBytes(source, off, len, NO_OPTIONS); } // end encodeBytes
/** * Given a comma separated string, get the tokens as a {@link List} * * @param str * * @return */ public static List<String> tokenize(String str) { return tokenize(str, ","); }
/** * Serializes an object and returns the Base64-encoded version of that serialized object. If the object cannot be serialized * or there is another error, the method will return <tt>null</tt>. The object is not GZip-compressed before being encoded. * * @param serializableObject The object to encode * @return The Base64-encoded object * @since 1.4 */ public static String encodeObject(java.io.Serializable serializableObject) { return encodeObject(serializableObject, NO_OPTIONS); } // end encodeObject
/** * Use the transformer to transform * * @param transformer * @param stax * @param result * * @throws ParsingException */ public static void transform(Transformer transformer, StAXSource stax, DOMResult result) throws ParsingException { transform(transformer, (Source) stax, result); }
/** * Get the Custom Stax Source to DOM result transformer that has been written to get over the JDK transformer bugs * (JDK6) as well as the issue of Xalan installing its Transformer (which does not support stax). * * @return * * @throws ConfigurationException */ public static Transformer getStaxSourceToDomResultTransformer() throws ConfigurationException { return new PicketLinkStaxToDOMTransformer(); }
public static String encode64(byte[] secret, String cipherAlgorithm, SecretKey cipherKey, PBEParameterSpec cipherSpec) throws Exception { byte[] encoding = encode(secret, cipherAlgorithm, cipherKey, cipherSpec); String b64 = Base64.encodeBytes(encoding); return b64; }
/** * Encodes a byte array into Base64 notation. Does not GZip-compress data. * * @param source The data to convert * @param off Offset in array where conversion should begin * @param len Length of data to convert * @return the text node * @since 1.4 */ public static String encodeBytes(byte[] source, int off, int len) { return encodeBytes(source, off, len, NO_OPTIONS); } // end encodeBytes
/** * Get the Custom Stax Source to DOM result transformer that has been written to get over the JDK transformer bugs * (JDK6) as well as the issue of Xalan installing its Transformer (which does not support stax). * * @return * * @throws ConfigurationException */ public static Transformer getStaxSourceToDomResultTransformer() throws ConfigurationException { return new PicketLinkStaxToDOMTransformer(); }