Questions tagged [apache-commons-codec]

Apache Commons Codec provides implementations of common encoders and decoders such as Base64, Hex, Phonetic and URLs.

Apache Commons Codec was originally designed to be the definitive Base64 encoder, as there existed many different implementations.

While this package contains an abstract framework for the creation of encoders and decoders, Codec itself is primarily focused on providing functional utilities for working with common encodings.

http://commons.apache.org/proper/commons-codec/

63 questions
0
votes
1 answer

Apache common codec - Why Hex.encode() isn't static?

Base64 have many static encode methods returning byte[] as Base64.encodeBase64(stringToEncode.getBytes(StandardCharsets.UTF_8.name())); Also MessageDigest using static getInstance to encode/digest But Hex doesn't, it have only instance method…
Ori Marko
  • 56,308
  • 23
  • 131
  • 233
0
votes
1 answer

Base 64 encoding an image file in Groovy using Apache Commons

I am trying to encode an image file to a Base64 String using the directions on this site. The only difference is I have a groovy script (instead of Java), my entire script is just.... @Grapes( @Grab(group='commons-io', module='commons-io',…
AbuMariam
  • 3,282
  • 13
  • 49
  • 82
0
votes
1 answer

Using different encoder/decoder to convert binary to base64

Will using one type of encoder, to encode a binary message to base64(like the default one with jvm) and another(like apache commons codec) to decode this string to binary affect consistency of results? Or the type of encoders/decoders don't matter?
Vivek Agarwal
  • 301
  • 1
  • 2
  • 8
0
votes
0 answers

Issues with Hex.encodeHexString(byte[] hexStringByteArray);

I was used Hex.encodeHexString(byte[] hexStringByteArray); api for convert byte array to String but in two different situations not able to get the excepted values. Excepted String tcpPort = "1443"; In byte array [5,-93] --> In Hex String :…
Yellappa
  • 403
  • 1
  • 5
  • 16
0
votes
1 answer

Java Exceptions: Inappropriate key specification and short read of DER length

Using Base64 functions from the Apache Commons API and working with DSA I am trying to load a base 64 encoded public key from a file here is the method being used /** * Load a base-64 encoded public key in X.509 format * @param pkfile the name of…
cojoe
  • 45
  • 1
  • 8
0
votes
1 answer

Decrypting returns, javax.crypto.BadPaddingException: Given final block not properly padded

Im trying to decrypt the encrypted xml file. Im getting it as a inputstream as follows.I have the correct encrypt key. but each time my program returns empty string. Every time i enter the correct key. but each time it returns Badpadding Exception. …
Nwn
  • 561
  • 2
  • 9
  • 33
0
votes
1 answer

Java String base64 encode algorithm to match openssl implementation

As part of attempting to configure SAML AuthN with a Google Search Appliance, I need to convert my response into base64. For proof of concept, I just used the debugger in IntelliJ IDEA to replace the string with a version generated by the openssl…
Shawn D
  • 170
  • 1
  • 3
  • 12
0
votes
1 answer

I have a Netbeans project written in Java which uses commons codec. I get next error

What is the problem(package org.apache.commons.codec.binary.Base64 does not exist.)?
m88
  • 1,419
  • 2
  • 12
  • 18
0
votes
1 answer

Clojure/leiningen dependencies not downloading jars if nested

I'm getting the following error: #error { :cause org.apache.commons.codec.binary.Base32 :via [{:type clojure.lang.Compiler$CompilerException :message java.lang.ClassNotFoundException: org.apache.commons.codec.binary.Base32,…
0
votes
1 answer

Denodo Jar get conflicts with Play Framework Jar

I am using : Latest version of play framework wi.-> 2.3.5 Latest version of Denodo -> 5.5 win Denodo is using Apache Common Codec 1.3 whereas Play is using few new methods introduced in Apacahe Common Codec 1.4 (E.g. Caused by:…
Sagiruddin Mondal
  • 5,407
  • 2
  • 29
  • 44
0
votes
1 answer

Base64 encode and decode not give same result

I have been banging my head against a wall on this all day. I have a PDF file that we generate. The PDF file looks fine in Acrobat. I need to encode the file in base64. Using Apache codec library I do this: String base64buf =…
Mike Dee
  • 558
  • 1
  • 5
  • 13
0
votes
2 answers

Convert String to byte array (0x) - Java

I have a String value as "0x0601930600058000050001", need to convert to byte array byte[] codes1 = new byte[]{(byte)0x06,(byte)0x01,(byte)0x93,(byte)0x06,(byte)0x00,(byte)0x05,(byte)0x80,(byte)0x00,(byte)0x05,(byte)0x00,(byte)0x01}; for(byte b…
Molay
  • 1,154
  • 2
  • 19
  • 42
0
votes
1 answer

Apache common codec in java from string to hex and viceversa

I am trying to encode a string in hex and then convert it again to string. For this purpose I'm using the apache common codec. In particular I have defined the following methods: import org.apache.commons.codec.DecoderException; import…
papafe
  • 2,959
  • 4
  • 41
  • 72
0
votes
1 answer

How and Why are PDF and Excel files Base 64 encoded?

The application of Base64 encoding that I have read was to convert binary data or some string in to Base64 format. But I came to know of files (example: PDF, Excel) themselves Base64 encoded which can't be even opened/supported by respective…
sio2deep
  • 113
  • 2
  • 4
  • 12
0
votes
2 answers

Eclipse claims Commons-Codec methods don't exist

I'm working on validating the signed_request parameter from the Facebook API, following these guidelines, but I'm running into issues calling some of the methods of the Base64 class from Commons Codec. I added the commons-codec 1.6 library to my…
Chaosphere2112
  • 664
  • 7
  • 19