code: public String register(RegistrationRequest req, Member registrar) throws RegistrationException {
      	if (StringUtil.isNullOrEmpty(req.getEnrollmentID())) {
      		throw new IllegalArgumentException("EntrollmentID cannot be null or empty");
      	}
  
      	if (registrar == null) {
      		throw new IllegalArgumentException("Registrar should be a valid member");
      	}
  
  
      	Registrar reg = Registrar.newBuilder()
      			.setId(
      					Identity.newBuilder()
      					.setId(registrar.getName())
      					.build())
      			.build(); //TODO: set Roles and Delegate Roles
  
      	RegisterUserReq.Builder regReqBuilder = RegisterUserReq.newBuilder();
      	regReqBuilder.setId(
      					Identity.newBuilder()
      					.setId(req.getEnrollmentID())
      					.build());
      	regReqBuilder.setRoleValue(rolesToMask(req.getRoles()));
      	regReqBuilder.setAffiliation(req.getAffiliation());
      	regReqBuilder.setRegistrar(reg);
  
      	RegisterUserReq registerReq = regReqBuilder.build();
      	byte[] buffer = registerReq.toByteArray();
  
      	try {
              java.security.PrivateKey signKey = cryptoPrimitives.ecdsaKeyFromPrivate(Hex.decode(registrar.getEnrollment().getKey()));
  	    	logger.debug("Retreived private key");
              BigInteger[] signature = cryptoPrimitives.ecdsaSign(signKey, buffer);
  	    	logger.debug("Signed the request with key");
              Signature sig = Signature.newBuilder().setType(CryptoType.ECDSA).setR(ByteString.copyFrom(signature[0].toString().getBytes())).setS(ByteString.copyFrom(signature[1].toString().getBytes())).build();
  			regReqBuilder.setSig(sig);
  	    	logger.debug("Now sendingt register request");
  			Token token = this.ecaaClient.registerUser(regReqBuilder.build());
  			return token.getTok().toStringUtf8();
  
  		} catch (Exception e) {
  			throw new RegistrationException("Error while registering the user", e);
  		}
  
      }
docs: Register the member and return an enrollment secret.
  @param req Registration request with the following fields: name, role
  @param registrar The identity of the registrar (i.e. who is performing the registration)