- java.lang.Object
-
- org.apache.xml.security.utils.Base64
-
@Deprecated public final class Base64 extends Object
Deprecated.Implementation of MIME's Base64 encoding and decoding conversions. Optimized code. (raw version taken from oreilly.jonathan.util, and currently org.apache.xerces.ds.util.Base64)- See Also:
- RFC 2045,
TransformBase64Decode
-
-
Field Summary
Fields Modifier and Type Field Description static intBASE64DEFAULTLENGTHDeprecated.Field BASE64DEFAULTLENGTH
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static byte[]decode(byte[] base64)Deprecated.Method decodestatic voiddecode(byte[] base64Data, OutputStream os)Deprecated.Decodes Base64 data into outputstreamprotected static voiddecode(byte[] base64Data, OutputStream os, int len)Deprecated.static byte[]decode(BufferedReader reader)Deprecated.Base64 decode the lines from the reader and return an InputStream with the bytes.static voiddecode(InputStream is, OutputStream os)Deprecated.Decodes Base64 data into outputstreamstatic byte[]decode(String encoded)Deprecated.Decodes Base64 data into octetsstatic voiddecode(String base64Data, OutputStream os)Deprecated.Decodes Base64 data into outputstreamstatic byte[]decode(Element element)Deprecated.Method decode Takes theTextchildren of the Element and interprets them as input for theBase64.decode()function.static BigIntegerdecodeBigIntegerFromElement(Element element)Deprecated.Method decodeBigIntegerFromElementstatic BigIntegerdecodeBigIntegerFromText(Text text)Deprecated.Decode a base 64 string into aBigIntegerprotected static byte[]decodeInternal(byte[] base64Data, int len)Deprecated.static Stringencode(byte[] binaryData)Deprecated.Encode a byte array and fold lines at the standard 76th character unless ignore line breaks property is set.static Stringencode(byte[] binaryData, int length)Deprecated.Encode a byte array in Base64 format and return an optionally wrapped line.static Stringencode(BigInteger big)Deprecated.Encode in Base64 the given.BigIntegerstatic byte[]encode(BigInteger big, int bitlen)Deprecated.Returns a byte-array representation of a.BigIntegerstatic ElementencodeToElement(Document doc, String localName, byte[] bytes)Deprecated.Method encodeToElementstatic voidfillElementWithBigInteger(Element element, BigInteger biginteger)Deprecated.This method takes an (empty) Element and a BigInteger and adds the base64 encoded BigInteger to the Element.protected static intgetBytesInternal(String s, byte[] result)Deprecated.protected static booleanisPad(byte octet)Deprecated.protected static booleanisWhiteSpace(byte octet)Deprecated.protected static intremoveWhiteSpace(byte[] data)Deprecated.remove WhiteSpace from MIME containing encoded Base64 data.
-
-
-
Field Detail
-
BASE64DEFAULTLENGTH
public static final int BASE64DEFAULTLENGTH
Deprecated.Field BASE64DEFAULTLENGTH- See Also:
- Constant Field Values
-
-
Method Detail
-
encode
public static String encode(BigInteger big)
Deprecated.Encode in Base64 the given.BigInteger- Parameters:
big-- Returns:
- String with Base64 encoding
-
encode
public static byte[] encode(BigInteger big, int bitlen)
Deprecated.Returns a byte-array representation of a. No sign-bit is output. N.B.:BigInteger's toByteArray returns eventually longer arrays because of the leading sign-bit.BigInteger- Parameters:
big-BigIntegerto be convertedbitlen-intthe desired length in bits of the representation- Returns:
- a byte array with
bitlenbits ofbig
-
decodeBigIntegerFromElement
public static BigInteger decodeBigIntegerFromElement(Element element) throws Base64DecodingException
Deprecated.Method decodeBigIntegerFromElement- Parameters:
element-- Returns:
- the biginteger obtained from the node
- Throws:
Base64DecodingException
-
decodeBigIntegerFromText
public static BigInteger decodeBigIntegerFromText(Text text) throws Base64DecodingException
Deprecated.Decode a base 64 string into aBigInteger- Parameters:
text- Base 64 encoded text.- Returns:
- a decoded BigInteger
- Throws:
Base64DecodingException
-
fillElementWithBigInteger
public static void fillElementWithBigInteger(Element element, BigInteger biginteger)
Deprecated.This method takes an (empty) Element and a BigInteger and adds the base64 encoded BigInteger to the Element.- Parameters:
element-biginteger-
-
decode
public static byte[] decode(Element element) throws Base64DecodingException
Deprecated.Method decode Takes theTextchildren of the Element and interprets them as input for theBase64.decode()function.- Parameters:
element-- Returns:
- the byte obtained of the decoding the element $todo$ not tested yet
- Throws:
Base64DecodingException
-
encodeToElement
public static Element encodeToElement(Document doc, String localName, byte[] bytes)
Deprecated.Method encodeToElement- Parameters:
doc-localName-bytes-- Returns:
- an Element with the base64 encoded in the text.
-
decode
public static byte[] decode(byte[] base64) throws Base64DecodingExceptionDeprecated.Method decode- Parameters:
base64-- Returns:
- the UTF bytes of the base64
- Throws:
Base64DecodingException
-
encode
public static String encode(byte[] binaryData)
Deprecated.Encode a byte array and fold lines at the standard 76th character unless ignore line breaks property is set.- Parameters:
binaryData-byte[]to be base64 encoded- Returns:
- the
Stringwith encoded data
-
decode
public static byte[] decode(BufferedReader reader) throws IOException, Base64DecodingException
Deprecated.Base64 decode the lines from the reader and return an InputStream with the bytes.- Parameters:
reader-- Returns:
- InputStream with the decoded bytes
- Throws:
IOException- passes what the reader throwsIOExceptionBase64DecodingException
-
isWhiteSpace
protected static boolean isWhiteSpace(byte octet)
Deprecated.
-
isPad
protected static boolean isPad(byte octet)
Deprecated.
-
encode
public static String encode(byte[] binaryData, int length)
Deprecated.Encode a byte array in Base64 format and return an optionally wrapped line.- Parameters:
binaryData-byte[]data to be encodedlength-intlength of wrapped lines; No wrapping if less than 4.- Returns:
- a
Stringwith encoded data
-
decode
public static byte[] decode(String encoded) throws Base64DecodingException
Deprecated.Decodes Base64 data into octets- Parameters:
encoded- String containing base64 encoded data- Returns:
- byte array containing the decoded data
- Throws:
Base64DecodingException- if there is a problem decoding the data
-
getBytesInternal
protected static int getBytesInternal(String s, byte[] result)
Deprecated.
-
decodeInternal
protected static byte[] decodeInternal(byte[] base64Data, int len) throws Base64DecodingExceptionDeprecated.- Throws:
Base64DecodingException
-
decode
public static void decode(String base64Data, OutputStream os) throws Base64DecodingException, IOException
Deprecated.Decodes Base64 data into outputstream- Parameters:
base64Data- String containing Base64 dataos- the outputstream- Throws:
IOExceptionBase64DecodingException
-
decode
public static void decode(byte[] base64Data, OutputStream os) throws Base64DecodingException, IOExceptionDeprecated.Decodes Base64 data into outputstream- Parameters:
base64Data- Byte array containing Base64 dataos- the outputstream- Throws:
IOExceptionBase64DecodingException
-
decode
protected static void decode(byte[] base64Data, OutputStream os, int len) throws Base64DecodingException, IOExceptionDeprecated.- Throws:
Base64DecodingExceptionIOException
-
decode
public static void decode(InputStream is, OutputStream os) throws Base64DecodingException, IOException
Deprecated.Decodes Base64 data into outputstream- Parameters:
is- containing Base64 dataos- the outputstream- Throws:
IOExceptionBase64DecodingException
-
removeWhiteSpace
protected static int removeWhiteSpace(byte[] data)
Deprecated.remove WhiteSpace from MIME containing encoded Base64 data.- Parameters:
data- the byte array of base64 data (with WS)- Returns:
- the new length
-
-