security: In PublicKey, make the constructor set the key type from the keyDer and check the encoding. Remove method fromDer.
To get the PublicKey, call the constructor instead of fromDer.