I am trying to manually create the signature tag for a web service call. I accessed the certificate from the keystore and accessed the public key for the certificate. I now have the problem in converting the RSAKeyValue to ds:CryptoBinary type. Code returns the Biginteger value for mudulus and exponent and I am looking for a method or algorithm to convert them to octets and then converting to Bas64. Here is my code
RSAPublicKey rsaKey = (RSAPublicKey)certificate.getPublicKey();
customSignature.Modulus = rsaKey.getModulus();
customSignature.Exponent = rsaKey.getPublicExponent();
Is there any solution available in Java for converting the integers to octet representation?
Try following code using apache commons codec framework: