Skip to content

Conversation

fzakaria
Copy link

Some changes I made internally at our company to support FIPS.
We are on a pretty old version but upstreaming the changes if other people find it useful.

elecharny and others added 2 commits April 28, 2015 20:58
Modify TlsKeyGenerator to support the BouncyCastle FIPS provider.
Additional changes
* key size expanded
* methods that create X509 were modified
import java.security.spec.X509EncodedKeySpec;
import java.util.Date;

import javax.security.auth.x500.X500Principal;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep the order of import as is (to conform with the code style of this repo)

/**
* Generates the default RSA key pair for the server.
*
* @see https://github.com/apache/directory-server/blob/2.0.0-M20/core/src/main/java/org/apache/directory/server/core/security/TlsKeyGenerator.java

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is a bit superfluous I think, please remove this.

*/
public class TlsKeyGenerator
@SuppressWarnings("all")
public final class TlsKeyGenerator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to make this a final class?

static
{
Security.addProvider( new BouncyCastleProvider() );
System.out.println("Using a modified version of TlsKeyGenerator to ensure Bouncy Castle FIPS provider is used.");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use LOG for this.

* http://www.apache.org/licenses/exports
*/
private static final int KEY_SIZE = 512;
private static final int KEY_SIZE = 1024;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change required?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes FIPS requires 1024+ key size

<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this ok to keep 1.7?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't compile any more unless this was set.
1.7 is not supported on my JDK.. Authors can reject this part of the contributions.

@elecharny
Copy link
Contributor

Thanks, will have a look at it!

@fzakaria
Copy link
Author

Thanks, will have a look at it!

I mostly wanted to share my fixes for anyone else struggling with FIPS compliance -- I am not sure on the stance of FIPS generally for the repo.
If you think this can be merged upstream; I can do more work to clean it up as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants