Give a public key, I want to generate a public digest. Below is the code in JSP, but I need this in Ruby. I'm uncertain of the equivalents of SecretKeySpec, doFinal, etc. I'm using hmac, and hmac-sha1 on the Ruby end of things.
String pub = 'my_public_key';
BASE64Encoder encoder = new BASE64Encoder();
Mac sha1Mac = Mac.getInstance("HmacSHA1");
SecretKeySpec publicKeySpec = new SecretKeySpec(pub.getBytes(), "HmacSHA1");
sha1Mac.init(publicKeySpec);
byte[] publicBytes = sha1Mac.doFinal(subscriptionID.getBytes());
String publicDigest = encoder.encodeBuffer(publicBytes);
publicDigest = publicDigest.replaceAll("\n", "");