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

Populate the security Provider "info" string #377

Open
jeking3 opened this issue Apr 10, 2024 · 3 comments
Open

Populate the security Provider "info" string #377

jeking3 opened this issue Apr 10, 2024 · 3 comments

Comments

@jeking3
Copy link

jeking3 commented Apr 10, 2024

@geedo0
Copy link
Contributor

geedo0 commented Apr 10, 2024

I'm open to the idea, but what is your use case? If we were to do this, it shouldn't be used for any kind of assertion. Perhaps just for logging the provider info?

JDK Doc

@jeking3
Copy link
Author

jeking3 commented Apr 10, 2024

The use case is to align it with other crypto providers and the Provider interface. The constructor allows for an info string to be provided. There is a getInfo() method. I cannot do this reliably because ACCP passes an empty string in for the info, so I have to do this:

            // https://github.com/corretto/amazon-corretto-crypto-provider/issues/377
            String info = null;
            if (preferredProvider.getName().equals("AmazonCorrettoCryptoProvider")) {
                info = String.format("%s %s%s",
                        preferredProvider.getName(),
                        AmazonCorrettoCryptoProvider.INSTANCE.getVersionStr(),
                        AmazonCorrettoCryptoProvider.INSTANCE.isFips() ? " [FIPS]" : "");
            } else {
                info = preferredProvider.getInfo();
            }
            log.info("Preferred crypto provider: " + info);

Something like this would be great:

    AmazonCorrettoCryptoProvider v2.3.3 [FIPS]

Where FIPS is optional, and there may be other optional configuration things that could go in a list here in the future.

@jeking3
Copy link
Author

jeking3 commented Apr 23, 2024

Here's what you get for the name | info from each provider today (OpenJDK8 + ACCP injected by security properties)

23 Apr 2024 14:33:48,579 Security providers at startup:
23 Apr 2024 14:33:48,579 Slot #1: AmazonCorrettoCryptoProvider | 
23 Apr 2024 14:33:48,579 Slot #2: SUN | SUN (DSA key/parameter generation; DSA signing; SHA-1, MD5 digests; SecureRandom; X.509 certificates; JKS & DKS keystores; PKIX CertPathValidator; PKIX CertPathBuilder; LDAP, Collection CertStores, JavaPolicy Policy; JavaLoginConfig Configuration)
23 Apr 2024 14:33:48,579 Slot #3: SunRsaSign | Sun RSA signature provider
23 Apr 2024 14:33:48,579 Slot #4: SunEC | Sun Elliptic Curve provider (EC, ECDSA, ECDH)
23 Apr 2024 14:33:48,579 Slot #5: SunJSSE | Sun JSSE provider(PKCS12, SunX509/PKIX key/trust factories, SSLv3/TLSv1/TLSv1.1/TLSv1.2/TLSv1.3)
23 Apr 2024 14:33:48,579 Slot #6: SunJCE | SunJCE Provider (implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE, Diffie-Hellman, HMAC)
23 Apr 2024 14:33:48,579 Slot #7: SunJGSS | Sun (Kerberos v5, SPNEGO)
23 Apr 2024 14:33:48,579 Slot #8: SunSASL | Sun SASL provider(implements client mechanisms for: DIGEST-MD5, GSSAPI, EXTERNAL, PLAIN, CRAM-MD5, NTLM; server mechanisms for: DIGEST-MD5, GSSAPI, CRAM-MD5, NTLM)
23 Apr 2024 14:33:48,579 Slot #9: XMLDSig | XMLDSig (DOM XMLSignatureFactory; DOM KeyInfoFactory; C14N 1.0, C14N 1.1, Exclusive C14N, Base64, Enveloped, XPath, XPath2, XSLT TransformServices)
23 Apr 2024 14:33:48,835 Slot #10: SunPCSC | Sun PC/SC provider

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