I want to add a key to a keystore. The keystore's method setKeyEntry
wants a Certificate
chain for the parameter. I created the Certificate
chain like this:
Certificate[] certChain = new Certificate[1];
However, I get the error:
"reference to Certificate is ambiguous both class org.bouncy.asn1.x.508.Certificate in org.bouncycastle.asn.1.x509 and interface java.security.Certificate in java.security match".
In my google search, I can find general help for ambiguous methods that doesn't help with my problem. What can I do to solve the problem at hand?
As the error has stated there's ambiguity with other classes and interfaces. setKeyEntry
takes a Certificate
argument which is located at java.security.cert.Certificate. Therefore to remove the ambiguity, you can prefix it with the full package name e.g.
java.security.cert.Certificate[] certChain = new java.security.cert.Certificate[1];