Skip to main content
Package: com.coinbase.cdp.auth
Parses private keys from various formats. Supports:
  • PEM-encoded EC keys (ES256)
  • Base64-encoded Ed25519 keys (64 bytes: 32-byte seed + 32-byte public key)
  • Base64-encoded PKCS#8 DER keys (for wallet secrets)

Method Details

parsePrivateKey

Parses a private key from PEM (EC) or base64 (Ed25519) format. Parameters: keyData (String) - the key data (PEM string or base64 encoded) Returns: PrivateKey - the parsed private key Throws: [KeyParseException](/sdks/cdp-sdks-v2/java/com/coinbase/cdp/auth/exceptions/KeyParseException "class in com.coinbase.cdp.auth.exceptions") - if parsing fails

parseWalletKey

Parses a wallet secret (base64 DER-encoded EC key). Parameters: walletSecret (String) - the base64-encoded PKCS#8 DER key Returns: PrivateKey - the parsed private key Throws: [KeyParseException](/sdks/cdp-sdks-v2/java/com/coinbase/cdp/auth/exceptions/KeyParseException "class in com.coinbase.cdp.auth.exceptions") - if parsing fails

isEcKey

Determines if a key is an EC key (ES256). Parameters: key (PrivateKey) - the private key Returns: boolean - true if the key uses EC algorithm

isEd25519Key

Determines if a key is an Ed25519 key (EdDSA). Parameters: key (PrivateKey) - the private key Returns: boolean - true if the key uses Ed25519/EdDSA algorithm