public static X509Certificate generateSelfSignedCertificate() throws GeneralSecurityException, IOException, OperatorCreationException {
  return new SelfSignedCertificateGenerator().certificate;
}

public static X509Certificate generateSelfSignedCertificate ( ) throws GeneralSecurityException , IOException , OperatorCreationException { return new SelfSignedCertificateGenerator ( ) . certificate ; }
create a random certificate
