fatedier/frp · error

no supported crypto algorithm

Error message

no supported crypto algorithm

What it means

During ServerHello construction the server found no AEAD algorithm in common with the client: SelectAEADAlgorithm walked clientHello.Capabilities.Crypto.Algorithms and none matched the server's supported set (aes-256-gcm, xchacha20-poly1305). The wire v2 protocol requires at least one shared AEAD before encryption can be negotiated.

Source

Thrown at pkg/proto/wire/crypto.go:62

	Algorithm      string
	TranscriptHash []byte
}

func NewClientHello(bootstrap BootstrapInfo) (ClientHello, error) {
	clientRandom, err := newCryptoRandom()
	if err != nil {
		return ClientHello{}, err
	}
	return clientHelloWithCryptoRandom(bootstrap, clientRandom), nil
}

func NewServerHello(clientHello ClientHello) (ServerHello, error) {
	if err := ValidateClientHello(clientHello); err != nil {
		return ServerHello{}, err
	}
	algorithm, ok := SelectAEADAlgorithm(clientHello.Capabilities.Crypto.Algorithms)
	if !ok {
		return ServerHello{}, fmt.Errorf("no supported crypto algorithm")
	}
	serverRandom, err := newCryptoRandom()
	if err != nil {
		return ServerHello{}, err
	}
	return ServerHello{
		Selected: ServerSelection{
			Message: MessageSelection{
				Codec:          MessageCodecJSON,
				UDPPacketCodec: selectUDPPacketCodec(clientHello.Capabilities.Message.UDPPacketCodecs),
			},
			Crypto: CryptoSelection{
				Algorithm:    algorithm,
				ServerRandom: serverRandom,
			},
		},
	}, nil
}

View on GitHub (pinned to 6c8a8d0a97)

Solutions

  1. Run the same (or compatible) frp version on both ends so both advertise aes-256-gcm / xchacha20-poly1305
  2. If on unusual hardware, verify the build supports at least one of the two AEADs (both are pure-Go capable)
  3. For custom clients, include at least one of the supported algorithm strings in the ClientHello capabilities

Example fix

// before (custom client)
hello.Capabilities.Crypto.Algorithms = []string{"my-aead"}

// after
hello.Capabilities.Crypto.Algorithms = []string{
  wire.AEADAlgorithmAES256GCM,
  wire.AEADAlgorithmXChaCha20Poly1305,
}
Defensive patterns

Strategy: validation

Validate before calling

// Offer both supported algorithms before connecting
hello.Capabilities.Crypto.Algorithms = []string{
    wire.AEADAlgorithmAES256GCM,
    wire.AEADAlgorithmXChaCha20Poly1305,
}

Try / catch

if _, err := wire.NewServerHello(clientHello); err != nil && strings.Contains(err.Error(), "no supported crypto algorithm") {
    // peer advertises incompatible algorithms: refuse instead of retrying
    return errors.New("incompatible peer crypto capabilities")
}

Prevention

When it happens

Trigger: NewServerHello with a ClientHello whose crypto algorithm list is empty or contains only algorithms this build does not support (or HW acceleration unavailable so AES-GCM/XChaCha20 is disabled).

Common situations: Cross-version connection where an older/other-party client advertises different algorithm names; a custom/forked client with a trimmed algorithm list; capability list lost/mangled in transit.

Related errors


AI-assisted analysis of fatedier/frp@6c8a8d0a97 (2026-08-15). Data as JSON: /api/errors/6596ba0f40b6e035. Report an issue: GitHub.