Calculate coordinates

I have oriented line. The line is given as two points (WGS84). I need to calculate coordinates(also WGS84) of next two points on one side (left or right) of the line in the given distance so all 4 points make together rectangle.

I need to place procedure of creating polygon to JEE server - there is postgis avaible and also many geo libraries… But i tried to search some feature which can help in Postgis, Libosm, Geotools and found nothing… Do you have some idea?