Imagine vanilla pastry cream colliding with chocolate ganache. That's exactly what chocolate pastry cream is! However, they don't need to be made separately.
In a separate bowl, whisk together the egg yolks, cornstarch, and vanilla extract until no lumps of cornstarch remain.
Cook the entire mixture, whisking constantly until thick, about 15 minutes or more in a bain marie or double boiler; half of that in a saucepan. The chocolate pastry cream won't begin to thicken until it reaches about 145ºF. (Never stop cooking raw eggs until they reach at least 145ºF.) However, you'll need to cook it to a higher temperature. Once the mixture coats the back of a spoon and you can draw a line in the cream and the line remains, it is done, at about 155ºF. Remove from the heat and stir in the remaining 1/2 cup of chocolate.
Set the saucepan aside and prepare an ice bath (ice and water). I use my sink. If you used a bain marie or double boiler, transfer the pastry cream to a cold saucepan or large bowl and add to the ice bath, whisking or stirring constantly to speed up cooling.
If you need a sturdy pastry cream for pies that need slicing, cake fillings, etc., add 1 teaspoon unflavored gelatin to 2 tablespoons room temperature water, stir, and allow to rest/bloom for 1 minute. Add 2 tablespoons boiling water, stir; set aside to cool. Stir this mixture into the pastry cream.
Transfer to a glass bowl or ramekins, cover with plastic wrap, directly over the pastry cream and refrigerate overnight or until chilled and set.
https://glutenfreerecipebox.com/chocolate-pastry-cream-gluten-free/