Does it return DER encoded data, or some other format?
The Javadoc I've been able to find leaves something to be desired details-wise...
At least for v1.52, org.bouncycastle.pkcs.PKCS10CertificationRequest#getEncoded()
is implemented as:
public byte[] More ...getEncoded()
throws IOException
{
return certificationRequest.getEncoded();
}
This calls org.bouncycastle.asn1.pkcs.CertificationRequest#getEncoded()
, which results in the inherited method org.bouncycastle.asn1.ASN1Object#getEncoded()
. This method actually has some Javadoc, and it states "Return the default BER or DER encoding for this object".
I wasn't completely sure whether this guarantees DER encoding, so I did the following:
private byte[] makeDEREncodedRequest(final PKCS10CertificationRequest request) {
try {
return request.toASN1Structure().getEncoded(ASN1Encoding.DER);
} catch (IOException e) {
// ... <Exception handling code> ...
}
}