Encode Java keystore certificate chain entry

Hello all,
In  my code I am exporting a certificate from a java keystore via the Certificate's getEncoded function and then Base64 encoding the resulting encoded cert.  I will now be dealing with certificate chains as well.

My question is how do I export the certificate chain?  Do I call the getEncoded method on each of the certificates in the Certificate array and then concatinate them together?  Is there a more elegant method?

Thanks very much.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

There is no more elegant method than that.  AFIK there is not structure with dealing with certificate chains.

You don't say what version of Java you are working with either so it is difficult to be more explicit.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
edcAuthor Commented:
Thanks sweetfa2.  All the examples I have managed to troll say the same thing.  I'm using JDK 1.7, but it does not look like there is anything new in that arena either.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.