Their is many way to read data for data for digital signature but hear we discus reading data from .pfx file - code for read .pfx file - import java.io.FileInputStream; import java.security.KeyStore; import java.security.cert.X509Certificate; import java.util.Date; import java.util.Enumeration; import javax.net.ssl.KeyManagerFactory; public class PdfDemo { public static void checkExpire() { try { KeyManagerFactory kmf = javax.net.ssl.KeyManagerFactory.getInstance( "SunX509" ); KeyStore keystore = KeyStore.getInstance( "PKCS12" ); char[] password = "123456".toCharArray(); keystore.load( new FileInputStream( "demo.pfx" ), password ); //keystore.load(new FileInputStream(certificate), password); kmf.init( keystore, password ); Enumeration<String> aliases = keystore.aliases(); while ( aliases.hasMoreElements() ) {