Java tutorial
//package com.java2s; import java.io.UnsupportedEncodingException; import java.math.BigInteger; import java.security.KeyFactory; import java.security.PublicKey; import java.security.interfaces.RSAPublicKey; import java.security.spec.X509EncodedKeySpec; import org.apache.commons.codec.binary.Base64; public class Main { static String public_key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+mAHzzAOTyDeLqVGRbSe/Ys2dA0K0PYzs7VkhUcSczJEckLEqzjVWapmQ7XSXnONnOOA7LVzYLvvRc/3d0EK3gq1sF39JMKUpeaaI+OAuE3UVRLIxnmmMJBTkAGqSQuOhuG7qJstDCg49W3KeMc8ZXXg7T4TjRWr3Hg9VbH+RIwIDAQAB"; public static BigInteger computeUnblindSignature(BigInteger r, BigInteger bs) throws UnsupportedEncodingException { RSAPublicKey pubKey = (RSAPublicKey) getPublicKey(public_key); BigInteger n = pubKey.getModulus(); BigInteger s = r.modInverse(n).multiply(bs).mod(n); return s; } public static PublicKey getPublicKey(String key) { try { Base64 base64_decoder = new Base64(); byte[] byteKey = base64_decoder.decode(key.getBytes()); // , // Base64.DEFAULT); X509EncodedKeySpec X509publicKey = new X509EncodedKeySpec(byteKey); KeyFactory kf = KeyFactory.getInstance("RSA"); return kf.generatePublic(X509publicKey); } catch (Exception e) { e.printStackTrace(); } return null; } }