コード例 #1
0
ファイル: gem-keygen.go プロジェクト: gemrs/gem
func printKey(path string) int {
	key, err := crypto.LoadPrivateKey(path)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Unable to load key %v: %v\n", path, err)
		return 1
	}

	err = key.Validate()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Unable to validate key %v: %v\n", path, err)
		return 1
	}

	fmt.Printf("Private Exponent: %v\n", key.D)
	fmt.Printf("Public Exponent: %v\n", key.PublicKey.E)
	fmt.Printf("Modulus: %v\n", key.N)
	return 0
}
コード例 #2
0
ファイル: game_service.go プロジェクト: gemrs/gem
func (svc *GameService) Init(runite *runite.Context, rsaKeyPath string, auth auth.Provider) error {
	var err error
	var key *crypto.Keypair
	key, err = crypto.LoadPrivateKey(rsaKeyPath)
	if err != nil {
		return err
	}

	svc.runite = runite
	svc.key = key
	svc.auth = auth
	svc.NonExpirable = expire.NewNonExpirable()
	svc.world = world.NewInstance()

	game_event.PlayerFinishLogin.Register(event.NewListener(svc, playerFinishLogin))
	game_event.PlayerLogout.Register(event.NewListener(svc, playerCleanup))
	game_event.EntityRegionChange.Register(event.NewListener(svc, svc.EntityUpdate))
	game_event.EntitySectorChange.Register(event.NewListener(svc, svc.EntityUpdate))
	game_event.PlayerAppearanceUpdate.Register(event.NewListener(svc, svc.PlayerUpdate))
	return nil
}