You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by RJ <ss...@gmail.com> on 2017/05/13 02:05:21 UTC

Binary to Base64 Conversion

I have to deal with a binary value of base64 ID in a groovy script. So,
first I need to covert binary data to base64 format and then
decodeBase64().

Any clues/thoughts ? Thanks!!

Re: Binary to Base64 Conversion

Posted by Keith Suderman <su...@anc.org>.
> On May 15, 2017, at 7:56 PM, RJ <ss...@gmail.com> wrote:
> 
> the first problem is encoding. its coming in an encoded format that decodeBase64 cannot understand.

What does your vendor mean by "binary on top of base64"?  I suspect they are sending a byte[] that you are reading into a String object rather than treating it as a byte array.

> 
> Whats the equivalent of the following in groovy script?
> 
> env.put("java.naming.ldap.attributes.binary","APPUID");

If that is Java code then the "Groovy script" is exactly the same.  However, I'm starting to suspect an XY problem here... what are you really trying to accomplish?

Cheers,
Keith

> 
> Thanks Guys
> 
> On Sun, May 14, 2017 at 12:25 PM, RJ <ssoguroo@gmail.com <ma...@gmail.com>> wrote:
> the first problem is encoding. its coming in an encoded format that decodeBase64 cannot understand.
> 
> Whats the equivalent of the following in groovy script?
> 
> env.put("java.naming.ldap.attributes.binary","APPUID");
> 
> Thanks Guys
> 
> On Sun, May 14, 2017 at 6:59 AM, Jeff Cave <jefferey.cave@gmail.com <ma...@gmail.com>> wrote:
> I don't think this is not a Groovy problem, so much as a general programming problem.
> 
> The first thing I would point out is that in your example APPUID is not base64encoded, there is nothing to base64decode.
> 
> https://en.wikipedia.org/wiki/Base64 <https://en.wikipedia.org/wiki/Base64>
> 
> I notice that in your example, APPUID is 16 characters. Is APPUID a UUID (basically a 16-byte integer)?
> 
> If so, 
> You may be looking to create an object of type `java.util.UUID`. 
> You could also possibly use `java.math.BigInteger`
> Converting the binary array to a String in hex notation may also be meaningful.
> It all depends on what your final intention is.
> 
> Jeff Cave
> 
> 
> On 14 May 2017 at 05:27, RJ <ssoguroo@gmail.com <ma...@gmail.com>> wrote:
> getBytes() disrupts the base64 format:
> 
> <groovy.lang.MissingMethodException: No signature of method: [B.decodeBase64() is applicable for argument types: () values: []
> Possible solutions: encodeBase64(), encodeBase64(boolean)>
> org.codehaus.groovy.runtime.In <http://org.codehaus.groovy.runtime.in/>vokerInvocationException: groovy.lang.MissingMethodException: No signature of method: [B.decodeBase64() is applicable for argument types: () values: []
> Possible solutions: encodeBase64(), encodeBase64(boolean)
> 
> Thanks
> 
> 
> On Sat, May 13, 2017 at 12:55 AM, Nelson, Erick <Erick.Nelson@hdsupply.com <ma...@hdsupply.com>> wrote:
> can appuid be read as bytes ( byte[] ) ??
> if So , then try then decodeBase64(byte[]) method maybe?
> 
> Erick Nelson
> Senior Developer
> HD Supply, FM
> Cell 858-740-6523 <tel:(858)%20740-6523>
> Home 760-930-0461 <tel:(760)%20930-0461>
> 
> CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only and may contain information that is confidential, proprietary or exempt from disclosure, and subject to terms at: http://www.hdsupply.com/email <http://www.hdsupply.com/email>.
> 
> From: RJ <ssoguroo@gmail.com <ma...@gmail.com>>
> Reply-To: "users@groovy.apache.org <ma...@groovy.apache.org>" <users@groovy.apache.org <ma...@groovy.apache.org>>
> Date: Friday, May 12, 2017 at 8:17 PM
> To: "users@groovy.apache.org <ma...@groovy.apache.org>" <users@groovy.apache.org <ma...@groovy.apache.org>>
> Subject: Re: Binary to Base64 Conversion
> 
> Erick,
> 
> Thanks for the response.
> 
> The binary value from the webservice is 
> 
> APPUID=.�&Y���A�Tzg�<�^,
> 
> The vendor tells me its binary on top of base64. If I try decodeBase64() on this, it throws: bad character in base64 value
> I guess I need to convert it first from binary to base64 format, and then decodeBase64().
> 
> 
> I don't find binary to base64 decoding in the link.
> 
> On Fri, May 12, 2017 at 10:07 PM, Nelson, Erick <Erick.Nelson@hdsupply.com <ma...@hdsupply.com>> wrote:
> Apache Commons codec
> 
> https://commons.apache.org/proper/commons-codec/apidocs/org/apache/commons/codec/binary/Base64.html <https://urldefense.proofpoint.com/v2/url?u=https-3A__commons.apache.org_proper_commons-2Dcodec_apidocs_org_apache_commons_codec_binary_Base64.html&d=DwMFaQ&c=G6gE9wZC434W5IaU4ofEKQ&r=dNrS-0eOrjqS9LI6Io5GnPqWzmfgaVqofJ4wYWYOmSA&m=WM_-amrwjfsg0z9JtYQbL97RHE8WsP3d-sfNGOteJNc&s=4uDxi14KhTuGGpfmbK4mWz3sHEAmh2aNFwXeT1bJIh4&e=>
> 
> Erick Nelson
> Senior Developer
> HD Supply, FM
> Cell 858-740-6523 <tel:(858)%20740-6523>
> Home 760-930-0461 <tel:(760)%20930-0461>
> 
> CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only and may contain information that is confidential, proprietary or exempt from disclosure, and subject to terms at: http://www.hdsupply.com/email <http://www.hdsupply.com/email>.
> 
> From: RJ <ssoguroo@gmail.com <ma...@gmail.com>>
> Reply-To: "users@groovy.apache.org <ma...@groovy.apache.org>" <users@groovy.apache.org <ma...@groovy.apache.org>>
> Date: Friday, May 12, 2017 at 7:05 PM
> To: "users@groovy.apache.org <ma...@groovy.apache.org>" <users@groovy.apache.org <ma...@groovy.apache.org>>
> Subject: Binary to Base64 Conversion
> 
> I have to deal with a binary value of base64 ID in a groovy script. So, first I need to covert binary data to base64 format and then decodeBase64(). 
> 
> Any clues/thoughts ? Thanks!!
> 
> 
> 
> 
> 

----------------------
Keith Suderman
Research Associate
Department of Computer Science
Vassar College, Poughkeepsie NY
suderman@cs.vassar.edu





Re: Binary to Base64 Conversion

Posted by RJ <ss...@gmail.com>.
the first problem is encoding. its coming in an encoded format that
decodeBase64 cannot understand.

Whats the equivalent of the following in groovy script?

env.put("java.naming.ldap.attributes.binary","APPUID");

Thanks Guys

On Sun, May 14, 2017 at 12:25 PM, RJ <ss...@gmail.com> wrote:

> the first problem is encoding. its coming in an encoded format that decodeBase64 cannot understand.
>
> Whats the equivalent of the following in groovy script?
>
> env.put("java.naming.ldap.attributes.binary","APPUID");
>
> Thanks Guys
>
>
> On Sun, May 14, 2017 at 6:59 AM, Jeff Cave <je...@gmail.com>
> wrote:
>
>> I don't think this is not a Groovy problem, so much as a general
>> programming problem.
>>
>> The first thing I would point out is that in your example APPUID is not
>> base64encoded, there is nothing to base64decode.
>>
>> https://en.wikipedia.org/wiki/Base64
>>
>>
>> I notice that in your example, APPUID is 16 characters. Is APPUID a UUID
>> (basically a 16-byte integer)?
>>
>> If so,
>>
>>    - You may be looking to create an object of type `java.util.UUID`.
>>    - You could also possibly use `java.math.BigInteger`
>>    - Converting the binary array to a String in hex notation may also be
>>    meaningful.
>>
>> It all depends on what your final intention is.
>>
>> Jeff Cave
>>
>>
>> On 14 May 2017 at 05:27, RJ <ss...@gmail.com> wrote:
>>
>>> getBytes() disrupts the base64 format:
>>>
>>> <groovy.lang.MissingMethodException: No signature of method:
>>> [B.decodeBase64() is applicable for argument types: () values: []
>>> Possible solutions: encodeBase64(), encodeBase64(boolean)>
>>> org.codehaus.groovy.runtime.InvokerInvocationException:
>>> groovy.lang.MissingMethodException: No signature of method:
>>> [B.decodeBase64() is applicable for argument types: () values: []
>>> Possible solutions: encodeBase64(), encodeBase64(boolean)
>>>
>>> Thanks
>>>
>>>
>>> On Sat, May 13, 2017 at 12:55 AM, Nelson, Erick <
>>> Erick.Nelson@hdsupply.com> wrote:
>>>
>>>> can appuid be read as bytes ( byte[] ) ??
>>>> if So , then try then decodeBase64(byte[]) method maybe?
>>>>
>>>> Erick Nelson
>>>> Senior Developer
>>>> HD Supply, FM
>>>> Cell 858-740-6523 <(858)%20740-6523>
>>>> Home 760-930-0461 <(760)%20930-0461>
>>>>
>>>> *CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only
>>>> and may contain information that is confidential, proprietary or exempt
>>>> from disclosure, and subject to terms at: **http://www.hdsupply.com/email
>>>> <http://www.hdsupply.com/email>**.*
>>>>
>>>> From: RJ <ss...@gmail.com>
>>>> Reply-To: "users@groovy.apache.org" <us...@groovy.apache.org>
>>>> Date: Friday, May 12, 2017 at 8:17 PM
>>>> To: "users@groovy.apache.org" <us...@groovy.apache.org>
>>>> Subject: Re: Binary to Base64 Conversion
>>>>
>>>> Erick,
>>>>
>>>> Thanks for the response.
>>>>
>>>> The binary value from the webservice is
>>>>
>>>> APPUID=.�&Y���A�Tzg�<�^,
>>>>
>>>> The vendor tells me its binary on top of base64. If I try
>>>> decodeBase64() on this, it throws: bad character in base64 value
>>>> I guess I need to convert it first from binary to base64 format, and
>>>> then decodeBase64().
>>>>
>>>>
>>>> I don't find binary to base64 decoding in the link.
>>>>
>>>> On Fri, May 12, 2017 at 10:07 PM, Nelson, Erick <
>>>> Erick.Nelson@hdsupply.com> wrote:
>>>>
>>>>> Apache Commons codec
>>>>>
>>>>> https://commons.apache.org/proper/commons-codec/apidocs/org/
>>>>> apache/commons/codec/binary/Base64.html
>>>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__commons.apache.org_proper_commons-2Dcodec_apidocs_org_apache_commons_codec_binary_Base64.html&d=DwMFaQ&c=G6gE9wZC434W5IaU4ofEKQ&r=dNrS-0eOrjqS9LI6Io5GnPqWzmfgaVqofJ4wYWYOmSA&m=WM_-amrwjfsg0z9JtYQbL97RHE8WsP3d-sfNGOteJNc&s=4uDxi14KhTuGGpfmbK4mWz3sHEAmh2aNFwXeT1bJIh4&e=>
>>>>>
>>>>> Erick Nelson
>>>>> Senior Developer
>>>>> HD Supply, FM
>>>>> Cell 858-740-6523 <(858)%20740-6523>
>>>>> Home 760-930-0461 <(760)%20930-0461>
>>>>>
>>>>> *CONFIDENTIALITY NOTICE: This message is for intended addressee(s)
>>>>> only and may contain information that is confidential, proprietary or
>>>>> exempt from disclosure, and subject to terms at: **http://www.hdsupply.com/email
>>>>> <http://www.hdsupply.com/email>**.*
>>>>>
>>>>> From: RJ <ss...@gmail.com>
>>>>> Reply-To: "users@groovy.apache.org" <us...@groovy.apache.org>
>>>>> Date: Friday, May 12, 2017 at 7:05 PM
>>>>> To: "users@groovy.apache.org" <us...@groovy.apache.org>
>>>>> Subject: Binary to Base64 Conversion
>>>>>
>>>>> I have to deal with a binary value of base64 ID in a groovy script.
>>>>> So, first I need to covert binary data to base64 format and then
>>>>> decodeBase64().
>>>>>
>>>>> Any clues/thoughts ? Thanks!!
>>>>>
>>>>
>>>>
>>>
>>
>

Re: Binary to Base64 Conversion

Posted by RJ <ss...@gmail.com>.
the first problem is encoding. its coming in an encoded format that
decodeBase64 cannot understand.

Whats the equivalent of the following in groovy script?

env.put("java.naming.ldap.attributes.binary","APPUID");

Thanks Guys


On Sun, May 14, 2017 at 6:59 AM, Jeff Cave <je...@gmail.com> wrote:

> I don't think this is not a Groovy problem, so much as a general
> programming problem.
>
> The first thing I would point out is that in your example APPUID is not
> base64encoded, there is nothing to base64decode.
>
> https://en.wikipedia.org/wiki/Base64
>
>
> I notice that in your example, APPUID is 16 characters. Is APPUID a UUID
> (basically a 16-byte integer)?
>
> If so,
>
>    - You may be looking to create an object of type `java.util.UUID`.
>    - You could also possibly use `java.math.BigInteger`
>    - Converting the binary array to a String in hex notation may also be
>    meaningful.
>
> It all depends on what your final intention is.
>
> Jeff Cave
>
>
> On 14 May 2017 at 05:27, RJ <ss...@gmail.com> wrote:
>
>> getBytes() disrupts the base64 format:
>>
>> <groovy.lang.MissingMethodException: No signature of method:
>> [B.decodeBase64() is applicable for argument types: () values: []
>> Possible solutions: encodeBase64(), encodeBase64(boolean)>
>> org.codehaus.groovy.runtime.InvokerInvocationException:
>> groovy.lang.MissingMethodException: No signature of method:
>> [B.decodeBase64() is applicable for argument types: () values: []
>> Possible solutions: encodeBase64(), encodeBase64(boolean)
>>
>> Thanks
>>
>>
>> On Sat, May 13, 2017 at 12:55 AM, Nelson, Erick <
>> Erick.Nelson@hdsupply.com> wrote:
>>
>>> can appuid be read as bytes ( byte[] ) ??
>>> if So , then try then decodeBase64(byte[]) method maybe?
>>>
>>> Erick Nelson
>>> Senior Developer
>>> HD Supply, FM
>>> Cell 858-740-6523 <(858)%20740-6523>
>>> Home 760-930-0461 <(760)%20930-0461>
>>>
>>> *CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only
>>> and may contain information that is confidential, proprietary or exempt
>>> from disclosure, and subject to terms at: **http://www.hdsupply.com/email
>>> <http://www.hdsupply.com/email>**.*
>>>
>>> From: RJ <ss...@gmail.com>
>>> Reply-To: "users@groovy.apache.org" <us...@groovy.apache.org>
>>> Date: Friday, May 12, 2017 at 8:17 PM
>>> To: "users@groovy.apache.org" <us...@groovy.apache.org>
>>> Subject: Re: Binary to Base64 Conversion
>>>
>>> Erick,
>>>
>>> Thanks for the response.
>>>
>>> The binary value from the webservice is
>>>
>>> APPUID=.�&Y���A�Tzg�<�^,
>>>
>>> The vendor tells me its binary on top of base64. If I try decodeBase64()
>>> on this, it throws: bad character in base64 value
>>> I guess I need to convert it first from binary to base64 format, and
>>> then decodeBase64().
>>>
>>>
>>> I don't find binary to base64 decoding in the link.
>>>
>>> On Fri, May 12, 2017 at 10:07 PM, Nelson, Erick <
>>> Erick.Nelson@hdsupply.com> wrote:
>>>
>>>> Apache Commons codec
>>>>
>>>> https://commons.apache.org/proper/commons-codec/apidocs/org/
>>>> apache/commons/codec/binary/Base64.html
>>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__commons.apache.org_proper_commons-2Dcodec_apidocs_org_apache_commons_codec_binary_Base64.html&d=DwMFaQ&c=G6gE9wZC434W5IaU4ofEKQ&r=dNrS-0eOrjqS9LI6Io5GnPqWzmfgaVqofJ4wYWYOmSA&m=WM_-amrwjfsg0z9JtYQbL97RHE8WsP3d-sfNGOteJNc&s=4uDxi14KhTuGGpfmbK4mWz3sHEAmh2aNFwXeT1bJIh4&e=>
>>>>
>>>> Erick Nelson
>>>> Senior Developer
>>>> HD Supply, FM
>>>> Cell 858-740-6523 <(858)%20740-6523>
>>>> Home 760-930-0461 <(760)%20930-0461>
>>>>
>>>> *CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only
>>>> and may contain information that is confidential, proprietary or exempt
>>>> from disclosure, and subject to terms at: **http://www.hdsupply.com/email
>>>> <http://www.hdsupply.com/email>**.*
>>>>
>>>> From: RJ <ss...@gmail.com>
>>>> Reply-To: "users@groovy.apache.org" <us...@groovy.apache.org>
>>>> Date: Friday, May 12, 2017 at 7:05 PM
>>>> To: "users@groovy.apache.org" <us...@groovy.apache.org>
>>>> Subject: Binary to Base64 Conversion
>>>>
>>>> I have to deal with a binary value of base64 ID in a groovy script. So,
>>>> first I need to covert binary data to base64 format and then
>>>> decodeBase64().
>>>>
>>>> Any clues/thoughts ? Thanks!!
>>>>
>>>
>>>
>>
>

Re: Binary to Base64 Conversion

Posted by Jeff Cave <je...@gmail.com>.
I don't think this is not a Groovy problem, so much as a general
programming problem.

The first thing I would point out is that in your example APPUID is not
base64encoded, there is nothing to base64decode.

https://en.wikipedia.org/wiki/Base64


I notice that in your example, APPUID is 16 characters. Is APPUID a UUID
(basically a 16-byte integer)?

If so,

   - You may be looking to create an object of type `java.util.UUID`.
   - You could also possibly use `java.math.BigInteger`
   - Converting the binary array to a String in hex notation may also be
   meaningful.

It all depends on what your final intention is.

Jeff Cave


On 14 May 2017 at 05:27, RJ <ss...@gmail.com> wrote:

> getBytes() disrupts the base64 format:
>
> <groovy.lang.MissingMethodException: No signature of method:
> [B.decodeBase64() is applicable for argument types: () values: []
> Possible solutions: encodeBase64(), encodeBase64(boolean)>
> org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingMethodException:
> No signature of method: [B.decodeBase64() is applicable for argument types:
> () values: []
> Possible solutions: encodeBase64(), encodeBase64(boolean)
>
> Thanks
>
>
> On Sat, May 13, 2017 at 12:55 AM, Nelson, Erick <Erick.Nelson@hdsupply.com
> > wrote:
>
>> can appuid be read as bytes ( byte[] ) ??
>> if So , then try then decodeBase64(byte[]) method maybe?
>>
>> Erick Nelson
>> Senior Developer
>> HD Supply, FM
>> Cell 858-740-6523 <(858)%20740-6523>
>> Home 760-930-0461 <(760)%20930-0461>
>>
>> *CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only
>> and may contain information that is confidential, proprietary or exempt
>> from disclosure, and subject to terms at: **http://www.hdsupply.com/email
>> <http://www.hdsupply.com/email>**.*
>>
>> From: RJ <ss...@gmail.com>
>> Reply-To: "users@groovy.apache.org" <us...@groovy.apache.org>
>> Date: Friday, May 12, 2017 at 8:17 PM
>> To: "users@groovy.apache.org" <us...@groovy.apache.org>
>> Subject: Re: Binary to Base64 Conversion
>>
>> Erick,
>>
>> Thanks for the response.
>>
>> The binary value from the webservice is
>>
>> APPUID=.�&Y���A�Tzg�<�^,
>>
>> The vendor tells me its binary on top of base64. If I try decodeBase64()
>> on this, it throws: bad character in base64 value
>> I guess I need to convert it first from binary to base64 format, and then
>> decodeBase64().
>>
>>
>> I don't find binary to base64 decoding in the link.
>>
>> On Fri, May 12, 2017 at 10:07 PM, Nelson, Erick <
>> Erick.Nelson@hdsupply.com> wrote:
>>
>>> Apache Commons codec
>>>
>>> https://commons.apache.org/proper/commons-codec/apidocs/org/
>>> apache/commons/codec/binary/Base64.html
>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__commons.apache.org_proper_commons-2Dcodec_apidocs_org_apache_commons_codec_binary_Base64.html&d=DwMFaQ&c=G6gE9wZC434W5IaU4ofEKQ&r=dNrS-0eOrjqS9LI6Io5GnPqWzmfgaVqofJ4wYWYOmSA&m=WM_-amrwjfsg0z9JtYQbL97RHE8WsP3d-sfNGOteJNc&s=4uDxi14KhTuGGpfmbK4mWz3sHEAmh2aNFwXeT1bJIh4&e=>
>>>
>>> Erick Nelson
>>> Senior Developer
>>> HD Supply, FM
>>> Cell 858-740-6523 <(858)%20740-6523>
>>> Home 760-930-0461 <(760)%20930-0461>
>>>
>>> *CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only
>>> and may contain information that is confidential, proprietary or exempt
>>> from disclosure, and subject to terms at: **http://www.hdsupply.com/email
>>> <http://www.hdsupply.com/email>**.*
>>>
>>> From: RJ <ss...@gmail.com>
>>> Reply-To: "users@groovy.apache.org" <us...@groovy.apache.org>
>>> Date: Friday, May 12, 2017 at 7:05 PM
>>> To: "users@groovy.apache.org" <us...@groovy.apache.org>
>>> Subject: Binary to Base64 Conversion
>>>
>>> I have to deal with a binary value of base64 ID in a groovy script. So,
>>> first I need to covert binary data to base64 format and then
>>> decodeBase64().
>>>
>>> Any clues/thoughts ? Thanks!!
>>>
>>
>>
>

Re: Binary to Base64 Conversion

Posted by RJ <ss...@gmail.com>.
getBytes() disrupts the base64 format:

<groovy.lang.MissingMethodException: No signature of method:
[B.decodeBase64() is applicable for argument types: () values: []
Possible solutions: encodeBase64(), encodeBase64(boolean)>
org.codehaus.groovy.runtime.InvokerInvocationException:
groovy.lang.MissingMethodException: No signature of method:
[B.decodeBase64() is applicable for argument types: () values: []
Possible solutions: encodeBase64(), encodeBase64(boolean)

Thanks


On Sat, May 13, 2017 at 12:55 AM, Nelson, Erick <Er...@hdsupply.com>
wrote:

> can appuid be read as bytes ( byte[] ) ??
> if So , then try then decodeBase64(byte[]) method maybe?
>
> Erick Nelson
> Senior Developer
> HD Supply, FM
> Cell 858-740-6523 <(858)%20740-6523>
> Home 760-930-0461 <(760)%20930-0461>
>
> *CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only
> and may contain information that is confidential, proprietary or exempt
> from disclosure, and subject to terms at: **http://www.hdsupply.com/email
> <http://www.hdsupply.com/email>**.*
>
> From: RJ <ss...@gmail.com>
> Reply-To: "users@groovy.apache.org" <us...@groovy.apache.org>
> Date: Friday, May 12, 2017 at 8:17 PM
> To: "users@groovy.apache.org" <us...@groovy.apache.org>
> Subject: Re: Binary to Base64 Conversion
>
> Erick,
>
> Thanks for the response.
>
> The binary value from the webservice is
>
> APPUID=.�&Y���A�Tzg�<�^,
>
> The vendor tells me its binary on top of base64. If I try decodeBase64()
> on this, it throws: bad character in base64 value
> I guess I need to convert it first from binary to base64 format, and then
> decodeBase64().
>
>
> I don't find binary to base64 decoding in the link.
>
> On Fri, May 12, 2017 at 10:07 PM, Nelson, Erick <Erick.Nelson@hdsupply.com
> > wrote:
>
>> Apache Commons codec
>>
>> https://commons.apache.org/proper/commons-codec/apidocs/org/
>> apache/commons/codec/binary/Base64.html
>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__commons.apache.org_proper_commons-2Dcodec_apidocs_org_apache_commons_codec_binary_Base64.html&d=DwMFaQ&c=G6gE9wZC434W5IaU4ofEKQ&r=dNrS-0eOrjqS9LI6Io5GnPqWzmfgaVqofJ4wYWYOmSA&m=WM_-amrwjfsg0z9JtYQbL97RHE8WsP3d-sfNGOteJNc&s=4uDxi14KhTuGGpfmbK4mWz3sHEAmh2aNFwXeT1bJIh4&e=>
>>
>> Erick Nelson
>> Senior Developer
>> HD Supply, FM
>> Cell 858-740-6523 <(858)%20740-6523>
>> Home 760-930-0461 <(760)%20930-0461>
>>
>> *CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only
>> and may contain information that is confidential, proprietary or exempt
>> from disclosure, and subject to terms at: **http://www.hdsupply.com/email
>> <http://www.hdsupply.com/email>**.*
>>
>> From: RJ <ss...@gmail.com>
>> Reply-To: "users@groovy.apache.org" <us...@groovy.apache.org>
>> Date: Friday, May 12, 2017 at 7:05 PM
>> To: "users@groovy.apache.org" <us...@groovy.apache.org>
>> Subject: Binary to Base64 Conversion
>>
>> I have to deal with a binary value of base64 ID in a groovy script. So,
>> first I need to covert binary data to base64 format and then
>> decodeBase64().
>>
>> Any clues/thoughts ? Thanks!!
>>
>
>

Re: Binary to Base64 Conversion

Posted by "Nelson, Erick" <Er...@hdsupply.com>.
can appuid be read as bytes ( byte[] ) ??
if So , then try then decodeBase64(byte[]) method maybe?

Erick Nelson
Senior Developer
HD Supply, FM
Cell 858-740-6523
Home 760-930-0461

CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only and may contain information that is confidential, proprietary or exempt from disclosure, and subject to terms at: http://www.hdsupply.com/email.

From: RJ <ss...@gmail.com>>
Reply-To: "users@groovy.apache.org<ma...@groovy.apache.org>" <us...@groovy.apache.org>>
Date: Friday, May 12, 2017 at 8:17 PM
To: "users@groovy.apache.org<ma...@groovy.apache.org>" <us...@groovy.apache.org>>
Subject: Re: Binary to Base64 Conversion

Erick,

Thanks for the response.

The binary value from the webservice is

APPUID=.�&Y���A�Tzg�<�^,

The vendor tells me its binary on top of base64. If I try decodeBase64() on this, it throws: bad character in base64 value
I guess I need to convert it first from binary to base64 format, and then decodeBase64().


I don't find binary to base64 decoding in the link.

On Fri, May 12, 2017 at 10:07 PM, Nelson, Erick <Er...@hdsupply.com>> wrote:
Apache Commons codec

https://commons.apache.org/proper/commons-codec/apidocs/org/apache/commons/codec/binary/Base64.html<https://urldefense.proofpoint.com/v2/url?u=https-3A__commons.apache.org_proper_commons-2Dcodec_apidocs_org_apache_commons_codec_binary_Base64.html&d=DwMFaQ&c=G6gE9wZC434W5IaU4ofEKQ&r=dNrS-0eOrjqS9LI6Io5GnPqWzmfgaVqofJ4wYWYOmSA&m=WM_-amrwjfsg0z9JtYQbL97RHE8WsP3d-sfNGOteJNc&s=4uDxi14KhTuGGpfmbK4mWz3sHEAmh2aNFwXeT1bJIh4&e=>

Erick Nelson
Senior Developer
HD Supply, FM
Cell 858-740-6523<tel:(858)%20740-6523>
Home 760-930-0461<tel:(760)%20930-0461>

CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only and may contain information that is confidential, proprietary or exempt from disclosure, and subject to terms at: http://www.hdsupply.com/email.

From: RJ <ss...@gmail.com>>
Reply-To: "users@groovy.apache.org<ma...@groovy.apache.org>" <us...@groovy.apache.org>>
Date: Friday, May 12, 2017 at 7:05 PM
To: "users@groovy.apache.org<ma...@groovy.apache.org>" <us...@groovy.apache.org>>
Subject: Binary to Base64 Conversion

I have to deal with a binary value of base64 ID in a groovy script. So, first I need to covert binary data to base64 format and then decodeBase64().

Any clues/thoughts ? Thanks!!


Re: Binary to Base64 Conversion

Posted by RJ <ss...@gmail.com>.
Erick,

Thanks for the response.

The binary value from the webservice is

APPUID=.�&Y���A�Tzg�<�^,

The vendor tells me its binary on top of base64. If I try decodeBase64() on
this, it throws: bad character in base64 value
I guess I need to convert it first from binary to base64 format, and then
decodeBase64().


I don't find binary to base64 decoding in the link.

On Fri, May 12, 2017 at 10:07 PM, Nelson, Erick <Er...@hdsupply.com>
wrote:

> Apache Commons codec
>
> https://commons.apache.org/proper/commons-codec/apidocs/
> org/apache/commons/codec/binary/Base64.html
>
> Erick Nelson
> Senior Developer
> HD Supply, FM
> Cell 858-740-6523 <(858)%20740-6523>
> Home 760-930-0461 <(760)%20930-0461>
>
> *CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only
> and may contain information that is confidential, proprietary or exempt
> from disclosure, and subject to terms at: **http://www.hdsupply.com/email
> <http://www.hdsupply.com/email>**.*
>
> From: RJ <ss...@gmail.com>
> Reply-To: "users@groovy.apache.org" <us...@groovy.apache.org>
> Date: Friday, May 12, 2017 at 7:05 PM
> To: "users@groovy.apache.org" <us...@groovy.apache.org>
> Subject: Binary to Base64 Conversion
>
> I have to deal with a binary value of base64 ID in a groovy script. So,
> first I need to covert binary data to base64 format and then
> decodeBase64().
>
> Any clues/thoughts ? Thanks!!
>

RE: Binary to Base64 Conversion

Posted by "Winnebeck, Jason" <Ja...@windstream.com>.
You can use built-in encodeBase64 method in Groovy:

assert "AQID" == ([1,2,3] as byte[]).encodeBase64() as String

And you saw, decodeBase64 is the opposite. Does that do what you want?

Jason

From: Nelson, Erick [mailto:Erick.Nelson@hdsupply.com]
Sent: Friday, May 12, 2017 10:07 PM
To: users@groovy.apache.org
Subject: Re: Binary to Base64 Conversion

Apache Commons codec

https://commons.apache.org/proper/commons-codec/apidocs/org/apache/commons/codec/binary/Base64.html

Erick Nelson
Senior Developer
HD Supply, FM
Cell 858-740-6523
Home 760-930-0461

CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only and may contain information that is confidential, proprietary or exempt from disclosure, and subject to terms at: http://www.hdsupply.com/email.

From: RJ <ss...@gmail.com>>
Reply-To: "users@groovy.apache.org<ma...@groovy.apache.org>" <us...@groovy.apache.org>>
Date: Friday, May 12, 2017 at 7:05 PM
To: "users@groovy.apache.org<ma...@groovy.apache.org>" <us...@groovy.apache.org>>
Subject: Binary to Base64 Conversion

I have to deal with a binary value of base64 ID in a groovy script. So, first I need to covert binary data to base64 format and then decodeBase64().
Any clues/thoughts ? Thanks!!

This email message and any attachments are for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message and any attachments.

Re: Binary to Base64 Conversion

Posted by "Nelson, Erick" <Er...@hdsupply.com>.
Apache Commons codec

https://commons.apache.org/proper/commons-codec/apidocs/org/apache/commons/codec/binary/Base64.html

Erick Nelson
Senior Developer
HD Supply, FM
Cell 858-740-6523
Home 760-930-0461

CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only and may contain information that is confidential, proprietary or exempt from disclosure, and subject to terms at: http://www.hdsupply.com/email.

From: RJ <ss...@gmail.com>>
Reply-To: "users@groovy.apache.org<ma...@groovy.apache.org>" <us...@groovy.apache.org>>
Date: Friday, May 12, 2017 at 7:05 PM
To: "users@groovy.apache.org<ma...@groovy.apache.org>" <us...@groovy.apache.org>>
Subject: Binary to Base64 Conversion

I have to deal with a binary value of base64 ID in a groovy script. So, first I need to covert binary data to base64 format and then decodeBase64().

Any clues/thoughts ? Thanks!!