[Solved] How to get the public key? [closed]

I just downloaded your certificate and tested in my local import java.io.FileInputStream; import java.io.FileNotFoundException; import java.security.PublicKey; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; public static void main(String[] args) throws FileNotFoundException, CertificateException { FileInputStream fin = new FileInputStream(“C://Users/admin/Desktop/uidai_auth_stage.cer”); CertificateFactory f = CertificateFactory.getInstance(“X.509”); X509Certificate certificate = (X509Certificate)f.generateCertificate(fin); PublicKey pk = certificate.getPublicKey(); System.out.println(pk); } Output Sun RSA public key, … Read more

[Solved] Generating public key from modulus and exponent [duplicate]

As written by zaph in this answer, the following code should do what you want : NSData* bytesFromHexString(NSString * aString) { NSString *theString = [[aString componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] componentsJoinedByString:nil]; NSMutableData* data = [NSMutableData data]; int idx; for (idx = 0; idx+2 <= theString.length; idx+=2) { NSRange range = NSMakeRange(idx, 2); NSString* hexStr = [theString substringWithRange:range]; NSScanner* … Read more