Re: create Digest by name
David Hook <dgh-rTAZ0PM/[email protected]> Mon, 11 Mar 2019 05:18:48 +1100
| Newsgroups | gmane.comp.encryption.bouncy-castle.devel |
|---|---|
| Message-ID | <[email protected]> |
There's org.bouncycastle.jcajce.provider.util.DigestFactory - it might be more general than you want though, so you might still want to implement your own based on it. Regards, David On 9/3/19 11:31 pm, Hohwiller, Jörg wrote: > Hi there, > > I am looking for a way how to create a BC Digest by name. It seems this > use-case is not addressed. I can create a MessageDigest with BC Provider > by name but can not unwrap it via official API. > > However, I want to create an ECDSASigner with a HMacDSAKCalculator and > that requires a BC Digest. It seems that due to design flaws and > limitations of JCE there is a partial mess what can be done via official > Java APIs and what has to be done via BC proprietary APIs and in such > case this makes it unnecessary difficult. > > Of course I could use reflection hacks or put an own class in your > org.bouncycastle.jcajce.provider.digest package to unwrap the Digest > from BCMessageDigest but this does not seem to be a reliable or elegant > way. > > Otherwise I might end up with some ugly switch case statement that then > is very unflexible for digest algorithms I have not covered in my code > (that may be even added in the future without me maintaining the code). > > Any ideas how to solve this properly? What am I missing? > > Thank you so much > > Jörg > > >