Code example for X500Principal

0
keypair = keyGen.generateKeyPair(); // public/private key pair that we are creating certificate for
			serializeKeypair(context, keypair);
		} 
 
		X500Principal              dnName = new X500Principal("CN=" + getAccount(context));
		PKCS10CertificationRequest kpGen = new PKCS10CertificationRequest(
		                                                      "SHA1WithRSA", 
		                                                      dnName,
		                                                      keypair.getPublic(),
		                                                      null, 
		                                                      keypair.getPrivate());
		 
		Log.d("client", "Private key CSR: " + new String(keypair.getPrivate().getEncoded()));
		 
		String basecert = new String(Base64.encode(kpGen.getDEREncoded()));
		return postData(basecert);
	} 
	 
	public static boolean serializeKeypair(Context context, KeyPair keypair) 
	{