Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cipher.getInstance("AES/ECB/PKCS5Padding") Error #70

Closed
burakglc opened this issue Jun 4, 2022 · 3 comments
Closed

Cipher.getInstance("AES/ECB/PKCS5Padding") Error #70

burakglc opened this issue Jun 4, 2022 · 3 comments

Comments

@burakglc
Copy link

burakglc commented Jun 4, 2022

Hello.

Version 8.2.0-prerelease0379

cipher cipher = null;,

I define it as Cipher.getInstance("AES/ECB/PKCS5Padding"); I am getting error in method.
the error message is "The type initializer for 'javax.crypto.JceSecurity' threw an exception.' shaped.

image

cipher = Cipher.getInstance("AES/ECB/PKCS5Padding")

An error occurs with this line of code.

@wasabii
Copy link
Contributor

wasabii commented Jun 6, 2022

In develop I have fixed the type initializer exception. Was due to a problem opening compressed streams in the VFS. However, it now throws what appears to be a normal exception message saying "No such algorithm exists."

I need to dig into this more to understand how the JDK locates available algorithms, and why it thinks this one does not exist.

wasabii added a commit that referenced this issue Jun 6, 2022
Enable cipher and key tests.
fixes #70
@wasabii
Copy link
Contributor

wasabii commented Jun 6, 2022

Issue should be resolved in develop.

The JDK in java.security.Security.getProviders() reads the lib/security/java.security props file, which defines the class names of the security providers to enable. As long as these defined classes are on the classpath, the provider enumerates them for available algorithms. The issue was the VFS part again: it was opening the file, but not resetting the position of the returned memory stream. As such, when the stream made it's way over to Java, it only read the end and considered it an empty file, with no props, and thus no providers.

Pushing another prerelease with this fix.

@wasabii wasabii closed this as completed Jun 6, 2022
@wasabii
Copy link
Contributor

wasabii commented Jun 6, 2022

Note to self or others for later: The user really should be able to customize this file for an instance of the Runtime. We really need to think about what this means.

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

No branches or pull requests

2 participants