commons-crypto.git
3 months agoCRYPTO-141: Avoid calling operations on an invalid context. master 89/head
Marcelo Vanzin [Fri, 5 Oct 2018 16:31:34 +0000 (09:31 -0700)] 
CRYPTO-141: Avoid calling operations on an invalid context.

There are two main changes here.

The first one wraps the OpenSSL cipher context with some extra state
needed by the JNI wrapper. This allows checking whether it's safe to
call operations such as EVP_CipherUpdate, which can cause problems if
the context is not properly initialized. This more closely follows the
semantics of the Java interface.

The second change avoids cleaning up the OpenSSL context when an error
happens. Doing that would invalidate the memory used by the context,
but the Java code would still have the address of the now invalid
context, and calling another JNI method would crash the JVM. This
ties the lifecycle of the OpenSSL context to the Java cipher instance.

As part of those changes, all uses of EVP_CIPHER_CTX_cleanup were
removed; the remaining cleanup paths use EVP_CIPHER_CTX_free,
which is its replacement.

There are a few more changes that are not required for the above but
helped with testing and debugging:

- some very minor changes in Java code, especially using final fields
  where they make sense.
- enable -Wall and -Werror when compiling on linux64.
- fixed some minor issues with error handling in the native code.

Closes #80

3 months agoBind clirr:check to verify phase, publish clirr report.
Marcelo Vanzin [Thu, 4 Oct 2018 19:21:07 +0000 (12:21 -0700)] 
Bind clirr:check to verify phase, publish clirr report.

I also had to disable the Mac OS CI build because of CRYPTO-142.

Closes #88

3 months agoCRYPTO-135: Add comment about need for blocking sinks.
Marcelo Vanzin [Wed, 3 Oct 2018 17:48:14 +0000 (10:48 -0700)] 
CRYPTO-135: Add comment about need for blocking sinks.

Implementing non-blocking semantics in the WritableByteChannel portion
of CryptoOutputStream is non-trivial. The existing options require weird
return values and thus require the caller to know they're writing to
a CryptoOutputStream and not a regular byte channel. In that case, it's
better for the app to just not use the stream implementation and use
the ciphers directly, since that gives the code better control of
encryption.

This change just adds comments to warn API users that the output
streams are expected to be used only with blocking I/O.

Closes #87

3 months agoClean up a few build warnings.
Marcelo Vanzin [Tue, 2 Oct 2018 01:12:13 +0000 (18:12 -0700)] 
Clean up a few build warnings.

- remove references to the javancss plugin
- clear up javadoc warnings from checkstyle by only requiring them for
  methods that are protected (or more visible)
- remove an unused import

Closes #86

3 months agoRevert to commons-parent v43.
Marcelo Vanzin [Mon, 1 Oct 2018 20:08:24 +0000 (13:08 -0700)] 
Revert to commons-parent v43.

Seems like the newer maven-enforcer-plugin version is either buggy
or does not like maven 3.0 (since it seems to work fine with 3.5
locally). Let's revert to the previous commons-parent version for
now (which sets the enforcer plugin to version 1.4.1).

Closes #85

3 months agoAdd OS X to Travis CI matrix.
Marcelo Vanzin [Mon, 1 Oct 2018 19:59:54 +0000 (12:59 -0700)] 
Add OS X to Travis CI matrix.

Closes #83

3 months agoCleanup tests to not catch exceptions unnecessarily.
Marcelo Vanzin [Mon, 1 Oct 2018 19:52:02 +0000 (12:52 -0700)] 
Cleanup tests to not catch exceptions unnecessarily.

Catching exceptions and calling "Asserts.fail()" not only makes
the code more complicated than it should be, but it hides information
about the problem, since the original exception's stack trace is
lost.

It's also unnecessary to catch exceptions and fail the test when the
test itself declares that it's expecting that exception to be thrown.

While there I fixed a few misleading messages and some typos.

Closes #81

3 months agoAdd clirr:check target to CI build.
Marcelo Vanzin [Mon, 1 Oct 2018 19:46:23 +0000 (12:46 -0700)] 
Add clirr:check target to CI build.

- add default implementations for new interface methods that were added
- add an excludes file with an entry to ignore the current clirr failure
- disable javancss plugin since it does not like java 8 default methods

Closes #82

3 months agoBump requirement to Java 1.8
Marcelo Vanzin [Thu, 27 Sep 2018 21:31:00 +0000 (14:31 -0700)] 
Bump requirement to Java 1.8

Closes #84

7 months agoThe the patrol.
Gary Gregory [Sat, 16 Jun 2018 21:44:33 +0000 (15:44 -0600)] 
The the patrol.

8 months agoTypo: 'JavaDoc' -> 'Javadoc'.
Gary Gregory [Tue, 15 May 2018 18:21:00 +0000 (12:21 -0600)] 
Typo: 'JavaDoc' -> 'Javadoc'.

12 months agoUpdate commons-parent from 42 to 43.
Gary Gregory [Sun, 7 Jan 2018 20:40:34 +0000 (13:40 -0700)] 
Update commons-parent from 42 to 43.

13 months agoCRYPTO-125: Add new testcases for GCM cipher
Xianda Ke [Mon, 20 Nov 2017 00:38:23 +0000 (08:38 +0800)] 
CRYPTO-125: Add new testcases for GCM cipher

Closes #76 from kexianda/ut_gcm

13 months agoCRYPTO-60: opensslCipher support GCM mode
Xianda Ke [Sun, 19 Nov 2017 23:57:14 +0000 (07:57 +0800)] 
CRYPTO-60: opensslCipher support GCM mode

Closes #70 from kexianda/gcm3

19 months ago(chore) adding commons.module.name to pom
Rob Tompkins [Sun, 28 May 2017 00:28:13 +0000 (20:28 -0400)] 
(chore) adding commons.module.name to pom

23 months agoTab police
Sebb [Wed, 15 Feb 2017 22:11:02 +0000 (22:11 +0000)] 
Tab police

23 months agoCRYPTO-129 Revert unnecessary exposure of instance variables
Sebb [Wed, 15 Feb 2017 22:01:16 +0000 (22:01 +0000)] 
CRYPTO-129 Revert unnecessary exposure of instance variables

23 months agoCRYPTO-134 CipherByteBufferExample should not truncate the string
Sebb [Sat, 11 Feb 2017 12:14:45 +0000 (12:14 +0000)] 
CRYPTO-134 CipherByteBufferExample should not truncate the string

2 years agoFixed a typo
Hendrik Saly [Wed, 30 Nov 2016 07:54:04 +0000 (08:54 +0100)] 
Fixed a typo

2 years agoRemove tailing white spaces
Benedikt Ritter [Sat, 26 Nov 2016 11:49:29 +0000 (12:49 +0100)] 
Remove tailing white spaces

2 years agoMerge branch 'CRYPTO-131'
Benedikt Ritter [Sat, 26 Nov 2016 11:47:52 +0000 (12:47 +0100)] 
Merge branch 'CRYPTO-131'

2 years agoCRYPTO-131: Provide FAQ page
Benedikt Ritter [Sat, 26 Nov 2016 11:47:33 +0000 (12:47 +0100)] 
CRYPTO-131: Provide FAQ page

2 years agoFix mess I created in last commit
Benedikt Ritter [Sat, 26 Nov 2016 09:18:29 +0000 (10:18 +0100)] 
Fix mess I created in last commit

2 years agoSort pom.xml elements
Benedikt Ritter [Sat, 26 Nov 2016 09:16:23 +0000 (10:16 +0100)] 
Sort pom.xml elements

2 years agoAdd FAQ page
Benedikt Ritter [Sat, 26 Nov 2016 09:08:49 +0000 (10:08 +0100)] 
Add FAQ page

2 years agoFix broken JavaDoc link
Benedikt Ritter [Sat, 26 Nov 2016 08:56:44 +0000 (09:56 +0100)] 
Fix broken JavaDoc link

2 years agoFix travis
Sun Dapeng [Mon, 21 Nov 2016 01:36:55 +0000 (09:36 +0800)] 
Fix travis

2 years agoCRYPTO-129: Change access of instance variables
Tian Jianguo [Mon, 21 Nov 2016 01:16:07 +0000 (09:16 +0800)] 
CRYPTO-129: Change access of instance variables

Closes #73 from jianguotian/CRYPTO-129

2 years agoFix Coverall badge
Sun Dapeng [Mon, 21 Nov 2016 01:12:55 +0000 (09:12 +0800)] 
Fix Coverall badge

2 years agoMerge branch 'master' of https://git-wip-us.apache.org/repos/asf/commons-crypto.git
Gary Gregory [Sat, 19 Nov 2016 02:46:45 +0000 (18:46 -0800)] 
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/commons-crypto.git

2 years agoAdd Coverall badge.
Gary Gregory [Sat, 19 Nov 2016 02:46:37 +0000 (18:46 -0800)] 
Add Coverall badge.

2 years agoCRYPTO-127: CryptoInputStream#read should handle non-block case
Xianda Ke [Mon, 24 Oct 2016 03:22:21 +0000 (11:22 +0800)] 
CRYPTO-127: CryptoInputStream#read should handle non-block case

Closes #72 from kexianda/inputstream

2 years agoCRYPTO-125: CryptoOutputStream does not call write in a loop when underlying channel...
Junjie Chen [Mon, 24 Oct 2016 02:11:29 +0000 (10:11 +0800)] 
CRYPTO-125: CryptoOutputStream does not call write in a loop when underlying channel works in non-block mode. (Reviewed by Sun, Dapeng and Ke, Xianda)

Closes #71 from cjjnjust:master

2 years agoCRYPTO-124: Fix JavaCryptoRandom extend java.util.Random
Sun Dapeng [Wed, 7 Sep 2016 05:09:56 +0000 (13:09 +0800)] 
CRYPTO-124: Fix JavaCryptoRandom extend java.util.Random

2 years agoCRYPTO-123: Clean CRYPTO build script.
Sun Dapeng [Wed, 7 Sep 2016 05:04:13 +0000 (13:04 +0800)] 
CRYPTO-123: Clean CRYPTO build script.

2 years agoCRYPTO-122: Fix CRYPTO website after 1.0.0
Sun Dapeng [Wed, 17 Aug 2016 01:37:08 +0000 (09:37 +0800)] 
CRYPTO-122: Fix CRYPTO website after 1.0.0

2 years ago[maven-release-plugin] prepare for next development iteration
Dapeng Sun [Mon, 25 Jul 2016 08:56:02 +0000 (16:56 +0800)] 
[maven-release-plugin] prepare for next development iteration

2 years ago[maven-release-plugin] prepare release CRYPTO-1.0.0-RC1 CRYPTO-1.0.0 CRYPTO-1.0.0-RC1
Dapeng Sun [Mon, 25 Jul 2016 08:54:08 +0000 (16:54 +0800)] 
[maven-release-plugin] prepare release CRYPTO-1.0.0-RC1

2 years agoRelease Notes for 1.0.0
Dapeng Sun [Mon, 25 Jul 2016 08:45:33 +0000 (16:45 +0800)] 
Release Notes for 1.0.0

2 years agoFix assembly
Sun Dapeng [Fri, 22 Jul 2016 08:44:55 +0000 (16:44 +0800)] 
Fix assembly

2 years agoUpdate autogen documents
Sun Dapeng [Fri, 22 Jul 2016 07:12:47 +0000 (15:12 +0800)] 
Update autogen documents

2 years agoCRYPTO-119: Fix checkstyle issues
Sun Dapeng [Fri, 22 Jul 2016 06:40:55 +0000 (14:40 +0800)] 
CRYPTO-119: Fix checkstyle issues

2 years agoCRYPTO-118: Fix pmd and findbugs issues
Sun Dapeng [Thu, 21 Jul 2016 03:03:32 +0000 (11:03 +0800)] 
CRYPTO-118: Fix pmd and findbugs issues

2 years agoCRYPTO-116: Fix compile error at 64 bits windows
Xianda Ke [Tue, 19 Jul 2016 09:36:53 +0000 (17:36 +0800)] 
CRYPTO-116: Fix compile error at 64 bits windows

2 years agoCRYPTO-117: Define WINDOWS when _WIN64 and CYGWIN defined
Sun Dapeng [Tue, 19 Jul 2016 09:32:20 +0000 (17:32 +0800)] 
CRYPTO-117: Define WINDOWS when _WIN64 and CYGWIN defined

2 years agoDocn
Sebb [Wed, 13 Jul 2016 18:00:31 +0000 (19:00 +0100)] 
Docn

2 years agoWindows works
Sebb [Wed, 13 Jul 2016 17:58:34 +0000 (18:58 +0100)] 
Windows works

2 years agoInitial example; changes.xml needs more work
Sebb [Wed, 13 Jul 2016 09:23:00 +0000 (10:23 +0100)] 
Initial example; changes.xml needs more work

2 years agoDocn
Sebb [Wed, 13 Jul 2016 09:22:22 +0000 (10:22 +0100)] 
Docn

2 years agoDocn
Sebb [Wed, 13 Jul 2016 09:15:47 +0000 (10:15 +0100)] 
Docn

2 years agoMinGW now works
Sebb [Mon, 11 Jul 2016 00:13:03 +0000 (01:13 +0100)] 
MinGW now works

2 years agoCRYPTO-104 Native code should provide getVersion() methods
Sebb [Sun, 10 Jul 2016 23:45:55 +0000 (00:45 +0100)] 
CRYPTO-104 Native code should provide getVersion() methods

2 years agoMake compiled filename agree with source file
Sebb [Sun, 10 Jul 2016 14:39:11 +0000 (15:39 +0100)] 
Make compiled filename agree with source file

2 years agoCRYPTO-63 Add JNA binding
Sebb [Sun, 10 Jul 2016 13:01:56 +0000 (14:01 +0100)] 
CRYPTO-63 Add JNA binding

Work-round for JVM crash if close called more than once

2 years agoUnused
Sebb [Sun, 10 Jul 2016 12:40:12 +0000 (13:40 +0100)] 
Unused

2 years agoCRYPTO-111 Include minimal main class to show that the code is working
Sebb [Sun, 10 Jul 2016 12:39:33 +0000 (13:39 +0100)] 
CRYPTO-111 Include minimal main class to show that the code is working

2 years agoCRYPTO-114 exception.c/exception.h are not used
Sebb [Sun, 10 Jul 2016 11:50:21 +0000 (12:50 +0100)] 
CRYPTO-114 exception.c/exception.h are not used

2 years agoCRYPTO-113 Improve error reporting by factories
Sebb [Sat, 9 Jul 2016 23:47:59 +0000 (00:47 +0100)] 
CRYPTO-113 Improve error reporting by factories

2 years agoAnd class name
Sebb [Sat, 9 Jul 2016 22:51:22 +0000 (23:51 +0100)] 
And class name

2 years agoFix file name
Sebb [Sat, 9 Jul 2016 22:50:24 +0000 (23:50 +0100)] 
Fix file name

2 years agowinutils.h not needed on Windows
Sebb [Sat, 9 Jul 2016 22:32:14 +0000 (23:32 +0100)] 
winutils.h not needed on Windows

2 years agoWindows uses LoadLibrary/GetLastError
Sebb [Sat, 9 Jul 2016 18:43:51 +0000 (19:43 +0100)] 
Windows uses LoadLibrary/GetLastError

2 years agoBetter fix for LoadLibrary parameter on Windows
Sebb [Sat, 9 Jul 2016 18:38:29 +0000 (19:38 +0100)] 
Better fix for LoadLibrary parameter on Windows

2 years agoUndefine snprintf on MinGW
Sebb [Sat, 9 Jul 2016 18:00:30 +0000 (19:00 +0100)] 
Undefine snprintf on MinGW

2 years agoNo need to save the libary pointer once initialised
Sebb [Sat, 9 Jul 2016 17:07:20 +0000 (18:07 +0100)] 
No need to save the libary pointer once initialised

2 years agoCRYPTO-112 OpenSslCipher.loadingFailureReason should be a Throwable
Sebb [Sat, 9 Jul 2016 16:50:40 +0000 (17:50 +0100)] 
CRYPTO-112 OpenSslCipher.loadingFailureReason should be a Throwable

2 years agoAlso catch UnsatisfiedLinkError in case OpenSSL library cannot be found
Sebb [Sat, 9 Jul 2016 16:39:59 +0000 (17:39 +0100)] 
Also catch UnsatisfiedLinkError in case OpenSSL library cannot be found

2 years agoSyntax error: missing closing parenthesis
Sebb [Sat, 9 Jul 2016 14:45:34 +0000 (15:45 +0100)] 
Syntax error: missing closing parenthesis

2 years agoFix up Windows build:
Sebb [Sat, 9 Jul 2016 14:30:33 +0000 (15:30 +0100)] 
Fix up Windows build:

Needs config.h
Needs Unicode String

2 years ago/lib/ directory contains valid source files!
Sebb [Sat, 9 Jul 2016 14:29:29 +0000 (15:29 +0100)] 
/lib/ directory contains valid source files!

2 years agoAlready included in org_apache_commons_crypto.h
Sebb [Sat, 9 Jul 2016 13:46:40 +0000 (14:46 +0100)] 
Already included in org_apache_commons_crypto.h

2 years agoAlready included near top of file
Sebb [Sat, 9 Jul 2016 13:45:11 +0000 (14:45 +0100)] 
Already included near top of file

2 years agoIt works on MacOSX
Sebb [Sat, 9 Jul 2016 12:53:31 +0000 (13:53 +0100)] 
It works on MacOSX

2 years agoCRYPTO-110 Provide component version and name
Sebb [Sat, 9 Jul 2016 12:42:02 +0000 (13:42 +0100)] 
CRYPTO-110 Provide component version and name

2 years agoUnused import
Sebb [Sat, 9 Jul 2016 12:24:05 +0000 (13:24 +0100)] 
Unused import

2 years agoCRYPTO-103 NativeCodeLoader.getVersion() is not needed
Sebb [Sat, 9 Jul 2016 12:20:42 +0000 (13:20 +0100)] 
CRYPTO-103 NativeCodeLoader.getVersion() is not needed

2 years agoJavadoc
Sebb [Sat, 9 Jul 2016 11:04:39 +0000 (12:04 +0100)] 
Javadoc

2 years agoNo point recreating the File object
Sebb [Fri, 8 Jul 2016 23:19:16 +0000 (00:19 +0100)] 
No point recreating the File object

2 years agoClasspath does not need jni-classes
Sebb [Fri, 8 Jul 2016 16:55:21 +0000 (17:55 +0100)] 
Classpath does not need jni-classes

2 years agoUse try-with-resources.
ggregory [Fri, 8 Jul 2016 16:24:39 +0000 (09:24 -0700)] 
Use try-with-resources.

2 years agoUse try-with-resources.
ggregory [Fri, 8 Jul 2016 16:20:11 +0000 (09:20 -0700)] 
Use try-with-resources.

2 years agoFormatting: Missing spaces.
ggregory [Fri, 8 Jul 2016 16:19:46 +0000 (09:19 -0700)] 
Formatting: Missing spaces.

2 years agoUse try-with-resources.
ggregory [Fri, 8 Jul 2016 16:19:01 +0000 (09:19 -0700)] 
Use try-with-resources.

2 years agoFormatting: Missing spaces.
ggregory [Fri, 8 Jul 2016 16:18:37 +0000 (09:18 -0700)] 
Formatting: Missing spaces.

2 years agoUse try-with-resources.
ggregory [Fri, 8 Jul 2016 16:18:00 +0000 (09:18 -0700)] 
Use try-with-resources.

2 years agoStatement unnecessarily nested within else clause.
ggregory [Fri, 8 Jul 2016 16:16:38 +0000 (09:16 -0700)] 
Statement unnecessarily nested within else clause.

2 years agoUnused import: org.apache.commons.crypto.Crypto.
ggregory [Fri, 8 Jul 2016 16:15:54 +0000 (09:15 -0700)] 
Unused import: org.apache.commons.crypto.Crypto.

2 years agoThe declared exception GeneralSecurityException is not actually thrown
ggregory [Fri, 8 Jul 2016 16:15:18 +0000 (09:15 -0700)] 
The declared exception GeneralSecurityException is not actually thrown
by the method testDummmyRandom() from type CryptoRandomFactoryTest.

2 years agoAdd missing '@Override' annotations.
ggregory [Fri, 8 Jul 2016 16:14:28 +0000 (09:14 -0700)] 
Add missing '@Override' annotations.

2 years agoShow JNA status
Sebb [Thu, 7 Jul 2016 17:05:17 +0000 (18:05 +0100)] 
Show JNA status

2 years agoShow version if available; warn if JNI/JNA could not be init
Sebb [Thu, 7 Jul 2016 16:56:36 +0000 (17:56 +0100)] 
Show version if available; warn if JNI/JNA could not be init

2 years agoSkip tests if JNA cannot be enabled
Sebb [Thu, 7 Jul 2016 16:32:10 +0000 (17:32 +0100)] 
Skip tests if JNA cannot be enabled

2 years agoIf JNA cannot find the correct library, ensure the details are caught
Sebb [Thu, 7 Jul 2016 16:31:39 +0000 (17:31 +0100)] 
If JNA cannot find the correct library, ensure the details are caught

Don't try to create classes if the JNA libray is not enabled

2 years agoMore instructions
Sebb [Thu, 7 Jul 2016 14:55:06 +0000 (15:55 +0100)] 
More instructions

2 years agoCRYPTO-96: OpenSSL Random implementation silently falls back to Java
Sun Dapeng [Thu, 7 Jul 2016 06:37:20 +0000 (14:37 +0800)] 
CRYPTO-96: OpenSSL Random implementation silently falls back to Java

Fixes #66

2 years agoFixed the remaining incorrect files
Kristian Rosenvold [Thu, 7 Jul 2016 04:37:21 +0000 (06:37 +0200)] 
Fixed the remaining incorrect files

2 years agoAdded .gitattributes to fix line feed issues once and for all
Kristian Rosenvold [Thu, 7 Jul 2016 04:35:56 +0000 (06:35 +0200)] 
Added .gitattributes to fix line feed issues once and for all

2 years agoStupid Git
Sebb [Wed, 6 Jul 2016 23:36:10 +0000 (00:36 +0100)] 
Stupid Git

2 years agoFix name so it agrees with the class
Sebb [Wed, 6 Jul 2016 23:34:25 +0000 (00:34 +0100)] 
Fix name so it agrees with the class

2 years agoWindows does not have /dev/random
Sebb [Wed, 6 Jul 2016 23:06:41 +0000 (00:06 +0100)] 
Windows does not have /dev/random