Re: Java Snippet output is not equal to command line openssl command output , Why ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Aug 1, 2018, at 12:47 PM, timmy pony <tim.fortinbras@xxxxxxxxx> wrote:
> 
> On Wed, Aug 1, 2018 at 4:28 PM Viktor Dukhovni <openssl-users@xxxxxxxxxxxx> wrote:
> On Wed, Aug 01, 2018 at 09:24:38AM +0100, timmy pony wrote:
> 
> > I have tried this
> >
> > openssl dgst -sha256 -sign my_private.key -out /tmp/sign.sha256 codeTosign.txt
> 
> This produces raw binary output, no base64 encoding.  What is the
> content of the file "codeToSign.txt"?  Post the output of:
> 
>     od -tx1 < /tmp/codeToSign.txt
> 
>  od -tx1 < codeToSign.txt
> 0000000    73  61  6d  70  6c  65  20  69  6e  70  75  74  0a            
> 0000015

As expected, the disk file has a newline ending (0x0a) after the
input string.

> > public class SHA256RSA {
> > 
> >     public static void main(String[] args) throws Exception {
> >         String input = "sample input";
> 
> This input has no newline ending, perhaps the disk file does.

The input string signed by the Java code does not.  The signatures
are therefore *expected* to be different.

Either include a newline in the Java string, or create an input
file with no newline ending.

-- 
	Viktor.

-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux