code: def rsa_public_key_pkcs8_to_pkcs1(pkcs8_key):
      
      decoded_values = decoder.decode(pkcs8_key, asn1Spec=PublicKeyInfo())
  
      try:
          decoded_key = decoded_values[0]
      except IndexError:
          raise ValueError("Invalid public key encoding.")
  
      return decoded_key["publicKey"].asOctets()
docs: Convert a PKCS8-encoded RSA private key to PKCS1.