Skip to content

Subtleties with ed25519 and x25519 #1

@joe-p

Description

@joe-p

Currently the owner address is used for the verification method and key agreement:

	pubkey, err := AlgorandAddressToEd25519(ownerAddr)
			if err == nil {
				x25519Key, err := Ed25519ToX25519(pubkey)
				if err == nil {
					keyAgreements = append(keyAgreements, VerificationMethod{
						ID:                 didID + "#x25519-owner",
						Type:               KeyTypeX25519,
						Controller:         didID,
						PublicKeyMultibase: X25519ToMultibase(x25519Key),
					})
				}
			}

This can be problematic for rekeyed accounts because the the owner address may be rekeyed. This means either

A) The owner no longer has the respective private key
or
B) A malicious actor that now has the original private key can incorrectly verify themselves as the DID owner

I think the resolver should instead use algod to get the AuthAddr for ownerAddr and use that for verification methods.

Additionally an Algorand address may not correspond to a valid x25519 key if the Address comes from a soft-derived HD account since the private scalar is not properly clamped according to the standard. They may still be able to do a DH exchange with that unclamped scalar, but it will not be following the x25519 standard and compatibility with external libs may be a mixed bag.

There's also the problem of knowing whether an address is an app or lsig but this is less of a problem since no one will have the corresponding private key.

Honestly I would say if someone wants key exchange methods on their DID that should be a custom field not associated with the address due to the above complexities. At the very least, however, I would recommend using the AuthAddr

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions