public static RSASignature generateSignature(byte[] message, RSAPrivateKey pk) throws IOException
{
SHA1 md = new SHA1();
md.update(message);
byte[] sha_message = new byte[md.getDigestLength()];
md.digest(sha_message);
byte[] der_header = new byte[] { 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00,
0x04, 0x14 };
int rsa_block_len = (pk.getN().bitLength() + 7) / 8;