security: Implement PublicKey.toDer and getDigest.