func (a *AuthCommand) GenerateAndSignKeys() error {
	privSigningKeyBytes, err := ioutil.ReadFile(a.genSigningKeyPath)
	if err != nil {
		return trace.Wrap(err)
	}
	ca := native.New()
	defer ca.Close()
	privBytes, pubBytes, err := ca.GenerateKeyPair("")
	if err != nil {
		return trace.Wrap(err)
	}
	nodeID := uuid.New()
	certBytes, err := ca.GenerateHostCert(privSigningKeyBytes, pubBytes, nodeID, a.genAuthorityDomain, teleport.Roles{a.genRole}, 0)
	if err != nil {
		return trace.Wrap(err)
	}
	err = ioutil.WriteFile(a.genPubPath, certBytes, 0600)
	if err != nil {
		return trace.Wrap(err)
	}

	err = ioutil.WriteFile(a.genPrivPath, privBytes, 0600)
	if err != nil {
		return trace.Wrap(err)
	}

	fmt.Printf("wrote signed certificate to: %v and private key to: %v\n", a.genPubPath, a.genPrivPath)
	return nil
}
// GenerateAndSignKeys generates a new keypair and signs it for role
GenerateAndSignKeys generates a new keypair and signs it for role
// GenerateAndSignKeys generates a new keypair and signs it for role
func (a *AuthCommand) GenerateAndSignKeys() error {
	privSigningKeyBytes, err := ioutil.ReadFile(a.genSigningKeyPath)
	if err != nil {
		return trace.Wrap(err)
	}
	ca := native.New()
	defer ca.Close()
	privBytes, pubBytes, err := ca.GenerateKeyPair("")
	if err != nil {
		return trace.Wrap(err)
	}
	nodeID := uuid.New()
	certBytes, err := ca.GenerateHostCert(privSigningKeyBytes, pubBytes, nodeID, a.genAuthorityDomain, teleport.Roles{a.genRole}, 0)
	if err != nil {
		return trace.Wrap(err)
	}
	err = ioutil.WriteFile(a.genPubPath, certBytes, 0600)
	if err != nil {
		return trace.Wrap(err)
	}
	err = ioutil.WriteFile(a.genPrivPath, privBytes, 0600)
	if err != nil {
		return trace.Wrap(err)
	}
	fmt.Printf("wrote signed certificate to: %v and private key to: %v\n", a.genPubPath, a.genPrivPath)
	return nil
}
func ( a * AuthCommand ) GenerateAndSignKeys ( ) error { privSigningKeyBytes , err := ioutil . ReadFile ( a . genSigningKeyPath ) if err != nil { return trace . Wrap ( err ) } ca := native . New ( ) defer ca . Close ( ) privBytes , pubBytes , err := ca . GenerateKeyPair ( " " ) if err != nil { return trace . Wrap ( err ) } nodeID := uuid . New ( ) certBytes , err := ca . GenerateHostCert ( privSigningKeyBytes , pubBytes , nodeID , a . genAuthorityDomain , teleport . Roles { a . genRole } , 0 ) if err != nil { return trace . Wrap ( err ) } err = ioutil . WriteFile ( a . genPubPath , certBytes , 0600 ) if err != nil { return trace . Wrap ( err ) } err = ioutil . WriteFile ( a . genPrivPath , privBytes , 0600 ) if err != nil { return trace . Wrap ( err ) } fmt . Printf ( " \n " , a . genPubPath , a . genPrivPath ) return nil }
GenerateAndSignKeys generates a new keypair and signs it for role
GenerateAndSignKeys generates a new keypair and signs it for role