Re: commons-crypto JDK 11 compatibility

2019-05-25 Thread Alex Remily
It won't *build* on JDK 11 because the build script uses "javah" as opposed
to "javac -h", and Java 8 was the last JDK to support javah.  I can't speak
to binary compatibility because I haven't tested it on anything other than
Java 8.  I don't know of any specific reason why it wouldn't be binary
compatible with 11; the best advice I can give is to pull it out of the
Maven repo and try it.

The question of full support for JDK 11 is something I've recently posed to
the community in my pending pull request.

https://github.com/apache/commons-crypto/pull/94

Alex

On Sat, May 25, 2019 at 8:29 AM Gary Gregory  wrote:

> How is it not compatible ATM?
>
> Gary
>
> On Sat, May 25, 2019, 05:15 Dinesh J  wrote:
>
> > Hello community,
> >
> > Is there a plan for releasing a JDK 11 compatible version of
> > commons-crypto.
> >
> > Appreciate your help.
> >
> > --
> > Thanks,
> > Dinesh
> >
>


Re: [crypto] OpenSslCryptoRandomTest fails on Mac OS High Sierra

2018-03-23 Thread Alex Remily
I did a bit more troubleshooting.  I confirmed that the rdrand engine
loads natively on Mac High Sierra by running the below test program in
XCode.  I believe the issue is one of the commons-crypto build, not
openssl itself.  Hopefully, someone more familiar with the codebase
will pick this up and troubleshoot.

See 
https://software.intel.com/en-us/articles/how-to-use-the-rdrand-engine-in-openssl-for-random-number-generation.

/*
Copyright July, 2014 Intel Corporation
All Rights Reserved.

The source code, information and material ("Material") contained herein
is owned by Intel Corporation or its suppliers or licensors, and title
to such Material remains with Intel Corporation or its suppliers or
licensors. The Material contains proprietary information of Intel or
its suppliers and licensors. The Material is protected by worldwide
copyright laws and treaty provisions. No part of the Material may be used,
copied, reproduced, modified, published, uploaded, posted, transmitted,
distributed or disclosed in any way without Intel's prior express written
permission. No license under any patent, copyright or other intellectual
property rights in the Material is granted to or conferred upon you,
either expressly, by implication, inducement, estoppel or otherwise. Any
license under such intellectual property rights must be express and
approved by Intel in writing.

Unless otherwise agreed by Intel in writing, you may not remove or alter
this notice or any other notice embedded in Materials by Intel or Intel's
suppliers or licensors in any way.
*/

/*
 * This sample program fills a 64-byte buffer with random data using the
 * rdrand engine in OpenSSL
 */

#define BUFFERSZ 64

#include 
#include 
#include 

int main (int argc, char *argv[])
{
unsigned char buf[BUFFERSZ];
ENGINE *engine;
int i;

/* Set our buffer to all zeroes for demonstration purposes */

memset(buf, 0, BUFFERSZ);

/* Initialize the engine */

ENGINE_load_rdrand();

engine= ENGINE_by_id("rdrand");
if ( engine == NULL ) {
fprintf(stderr, "ENGINE_load_rdrand returned %lu\n", ERR_get_error());
exit(1);
}

if ( ! ENGINE_init(engine) ) {
fprintf(stderr, "ENGINE_init returned %lu\n", ERR_get_error());
exit(1);
}

/* Set the engine as the default engine for random numbers */

if ( ! ENGINE_set_default(engine, ENGINE_METHOD_RAND) ) {
fprintf(stderr, "ENGINE_set_default returned %lu\n", ERR_get_error());
exit(1);
}

/* Now call RAND_bytes to fill our buffer */

RAND_bytes(buf, BUFFERSZ);

/* Print our buffer as rows of 16 hex values */

for (i= 0; i< BUFFERSZ; ++i) {
if ( ! (i % 16) && i ) printf("\n");
printf("%02x ", buf[i]);
}
printf("\n");

ENGINE_finish(engine);
ENGINE_free(engine);
ENGINE_cleanup();
}

On Fri, Mar 23, 2018 at 9:01 AM, Rob Tompkins <chtom...@gmail.com> wrote:
> Yes, I can reproduce this error on the Mac running under:
>
> Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 
> 2018-02-24T14:49:05-05:00)
> Maven home: /usr/local/Cellar/maven/3.5.3/libexec
> Java version: 1.8.0_162, vendor: Oracle Corporation
> Java home: 
> /Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "mac os x", version: "10.13.3", arch: "x86_64", family: "mac"
>
>> On Mar 23, 2018, at 8:07 AM, Alex Remily <alex.rem...@gmail.com> wrote:
>>
>> Sending again, this time with a subject line.
>>
>> I’m building Apache Commons Crypto from source on Mac OS HighSierra
>> (10.13.3) and the CryptoRandom tests fail, apparently because of
>> failure to load the underlying random number generation library.  All
>> other tests pass.  I successfully built and tested on Ubuntu 16.04 in
>> a similar development environment, so the problem seems isolated to my
>> Mac.  Has anyone had a similar experience, or have any ideas why the
>> Mac is exhibiting this behavior?  I’ve tested two versions of openssl,
>> and both versions produced identical failures.
>>
>> Best wishes,
>>
>> Alex
>>
>>
>> [INFO] Scanning for projects...
>> [INFO]
>> [INFO] 
>> 
>> [INFO] Building Apache Commons Crypto 1.1.0-SNAPSHOT
>> [INFO] 
>> 
>> [INFO]
>> [INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven-3) @
>> commons-crypto ---
>> [INFO]
>> [INFO] --- build-helper-maven-plugin:3.0.0:parse-version
>> (parse-version) @ commons-crypto ---
>> [INFO]
&

[crypto] OpenSslCryptoRandomTest fails on Mac OS High Sierra

2018-03-23 Thread Alex Remily
Sending again, this time with a subject line.

I’m building Apache Commons Crypto from source on Mac OS HighSierra
(10.13.3) and the CryptoRandom tests fail, apparently because of
failure to load the underlying random number generation library.  All
other tests pass.  I successfully built and tested on Ubuntu 16.04 in
a similar development environment, so the problem seems isolated to my
Mac.  Has anyone had a similar experience, or have any ideas why the
Mac is exhibiting this behavior?  I’ve tested two versions of openssl,
and both versions produced identical failures.

Best wishes,

Alex


[INFO] Scanning for projects...
[INFO]
[INFO] 
[INFO] Building Apache Commons Crypto 1.1.0-SNAPSHOT
[INFO] 
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven-3) @
commons-crypto ---
[INFO]
[INFO] --- build-helper-maven-plugin:3.0.0:parse-version
(parse-version) @ commons-crypto ---
[INFO]
[INFO] --- maven-resources-plugin:2.7:resources (create-version-file)
@ commons-crypto ---
[INFO] Using 'iso-8859-1' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-antrun-plugin:1.8:run (javadoc.resources) @ commons-crypto ---
[INFO] Executing tasks

main:
 [copy] Copying 2 files to
/Users/Alex/Documents/git_repos/commons-crypto/target/apidocs/META-INF
[INFO] Executed tasks
[INFO]
[INFO] --- maven-remote-resources-plugin:1.5:process
(process-resource-bundles) @ commons-crypto ---
[INFO]
[INFO] --- buildnumber-maven-plugin:1.4:create (default) @ commons-crypto ---
[INFO] Executing: /bin/sh -c cd
'/Users/Alex/Documents/git_repos/commons-crypto' && 'git' 'rev-parse'
'--verify' 'HEAD'
[INFO] Working directory: /Users/Alex/Documents/git_repos/commons-crypto
[INFO] Storing buildNumber: d69ef9556f44c076034add15feef1c5513248404
at timestamp: 2018-03-22 17:12:10-0400
[INFO] Storing buildScmBranch: master
[INFO]
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @
commons-crypto ---
[INFO] Using 'iso-8859-1' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @
commons-crypto ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 38 source files to
/Users/Alex/Documents/git_repos/commons-crypto/target/classes
[INFO]
[INFO] --- maven-antrun-plugin:1.8:run (make) @ commons-crypto ---
[INFO] Executing tasks

make:
 [exec] 
"/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/javah"
-force -classpath target/classes -o
target/jni-classes/org/apache/commons/crypto/random/OpenSslCryptoRandomNative.h
org.apache.commons.crypto.random.OpenSslCryptoRandomNative
 [exec] gcc -arch x86_64 -Ilib/inc_mac
-I/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/include
-O2 -fPIC -mmacosx-version-min=10.5 -fvisibility=hidden
-I/usr/local/include -I/usr/local/Cellar/openssl/1.0.2n/include
-Ilib/include -I/usr/include
-I"src/main/native/org/apache/commons/crypto/"
-I"/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/include/darwin"
-I"target/jni-classes/org/apache/commons/crypto/cipher"
-I"target/jni-classes/org/apache/commons/crypto/random" -c
src/main/native/org/apache/commons/crypto/random/OpenSslCryptoRandomNative.c
-o target/commons-crypto-1.1.0-SNAPSHOT-Mac-x86_64/OpenSslCryptoRandomNative.o
 [exec] 
"/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/javah"
-force -classpath target/classes -o
target/jni-classes/org/apache/commons/crypto/cipher/OpenSslNative.h
org.apache.commons.crypto.cipher.OpenSslNative
 [exec] gcc -arch x86_64 -Ilib/inc_mac
-I/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/include
-O2 -fPIC -mmacosx-version-min=10.5 -fvisibility=hidden
-I/usr/local/include -I/usr/local/Cellar/openssl/1.0.2n/include
-Ilib/include -I/usr/include
-I"src/main/native/org/apache/commons/crypto/"
-I"/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/include/darwin"
-I"target/jni-classes/org/apache/commons/crypto/cipher"
-I"target/jni-classes/org/apache/commons/crypto/random" -c
src/main/native/org/apache/commons/crypto/cipher/OpenSslNative.c -o
target/commons-crypto-1.1.0-SNAPSHOT-Mac-x86_64/OpenSslNative.o
 [exec] 
"/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/javah"
-force -classpath target/classes -o
target/jni-classes/org/apache/commons/crypto/OpenSslInfoNative.h
org.apache.commons.crypto.OpenSslInfoNative
 [exec] gcc -arch x86_64 -Ilib/inc_mac
-I/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/include
-O2 -fPIC -mmacosx-version-min=10.5 -fvisibility=hidden
-I/usr/local/include -I/usr/local/Cellar/openssl/1.0.2n/include
-Ilib/include -I/usr/include
-I"src/main/native/org/apache/commons/crypto/"
-I"/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/include/darwin"

[crypto]

2018-03-22 Thread Alex Remily
I’m building Apache Commons Crypto from source on Mac OS HighSierra (10.13.3) 
and the CryptoRandom tests fail, apparently because of failure to load the 
underlying random number generation library.  All other tests pass.  I 
successfully built and tested on Ubuntu 16.04 in a similar development 
environment, so the problem seems isolated to my Mac.  Has anyone had a similar 
experience, or have any ideas why the Mac is exhibiting this behavior?  I’ve 
tested two versions of openssl, and both versions produced identical failures.

Best wishes,

Alex


[INFO] Scanning for projects...
[INFO] 
[INFO] 
[INFO] Building Apache Commons Crypto 1.1.0-SNAPSHOT
[INFO] 
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven-3) @ 
commons-crypto ---
[INFO] 
[INFO] --- build-helper-maven-plugin:3.0.0:parse-version (parse-version) @ 
commons-crypto ---
[INFO] 
[INFO] --- maven-resources-plugin:2.7:resources (create-version-file) @ 
commons-crypto ---
[INFO] Using 'iso-8859-1' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-antrun-plugin:1.8:run (javadoc.resources) @ commons-crypto ---
[INFO] Executing tasks

main:
 [copy] Copying 2 files to 
/Users/Alex/Documents/git_repos/commons-crypto/target/apidocs/META-INF
[INFO] Executed tasks
[INFO] 
[INFO] --- maven-remote-resources-plugin:1.5:process (process-resource-bundles) 
@ commons-crypto ---
[INFO] 
[INFO] --- buildnumber-maven-plugin:1.4:create (default) @ commons-crypto ---
[INFO] Executing: /bin/sh -c cd 
'/Users/Alex/Documents/git_repos/commons-crypto' && 'git' 'rev-parse' 
'--verify' 'HEAD'
[INFO] Working directory: /Users/Alex/Documents/git_repos/commons-crypto
[INFO] Storing buildNumber: d69ef9556f44c076034add15feef1c5513248404 at 
timestamp: 2018-03-22 17:12:10-0400
[INFO] Storing buildScmBranch: master
[INFO] 
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ 
commons-crypto ---
[INFO] Using 'iso-8859-1' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ 
commons-crypto ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 38 source files to 
/Users/Alex/Documents/git_repos/commons-crypto/target/classes
[INFO] 
[INFO] --- maven-antrun-plugin:1.8:run (make) @ commons-crypto ---
[INFO] Executing tasks

make:
 [exec] 
"/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/javah" 
-force -classpath target/classes -o 
target/jni-classes/org/apache/commons/crypto/random/OpenSslCryptoRandomNative.h 
org.apache.commons.crypto.random.OpenSslCryptoRandomNative
 [exec] gcc -arch x86_64 -Ilib/inc_mac 
-I/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/include -O2 
-fPIC -mmacosx-version-min=10.5 -fvisibility=hidden -I/usr/local/include 
-I/usr/local/Cellar/openssl/1.0.2n/include -Ilib/include -I/usr/include 
-I"src/main/native/org/apache/commons/crypto/" 
-I"/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/include/darwin"
 -I"target/jni-classes/org/apache/commons/crypto/cipher" 
-I"target/jni-classes/org/apache/commons/crypto/random" -c 
src/main/native/org/apache/commons/crypto/random/OpenSslCryptoRandomNative.c -o 
target/commons-crypto-1.1.0-SNAPSHOT-Mac-x86_64/OpenSslCryptoRandomNative.o
 [exec] 
"/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/javah" 
-force -classpath target/classes -o 
target/jni-classes/org/apache/commons/crypto/cipher/OpenSslNative.h 
org.apache.commons.crypto.cipher.OpenSslNative
 [exec] gcc -arch x86_64 -Ilib/inc_mac 
-I/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/include -O2 
-fPIC -mmacosx-version-min=10.5 -fvisibility=hidden -I/usr/local/include 
-I/usr/local/Cellar/openssl/1.0.2n/include -Ilib/include -I/usr/include 
-I"src/main/native/org/apache/commons/crypto/" 
-I"/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/include/darwin"
 -I"target/jni-classes/org/apache/commons/crypto/cipher" 
-I"target/jni-classes/org/apache/commons/crypto/random" -c 
src/main/native/org/apache/commons/crypto/cipher/OpenSslNative.c -o 
target/commons-crypto-1.1.0-SNAPSHOT-Mac-x86_64/OpenSslNative.o
 [exec] 
"/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/javah" 
-force -classpath target/classes -o 
target/jni-classes/org/apache/commons/crypto/OpenSslInfoNative.h 
org.apache.commons.crypto.OpenSslInfoNative
 [exec] gcc -arch x86_64 -Ilib/inc_mac 
-I/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/include -O2 
-fPIC -mmacosx-version-min=10.5 -fvisibility=hidden -I/usr/local/include 
-I/usr/local/Cellar/openssl/1.0.2n/include -Ilib/include -I/usr/include 
-I"src/main/native/org/apache/commons/crypto/"