Example #1
0
    def create_user(self, enrollment_id, org, msp_id, state_store=None):
        """Returns an instance of a user whose identity
            is stored in the CouchDBWallet

        :param enrollment_id: enrollment id
        :param org: organization
        :param msp_id: MSP id
        :param state_store:  (Default value = None)
        :return: a validated user instance
        """
        crypto_suit = ecies()

        if not self.exists(enrollment_id):
            raise AttributeError('"user" does not exist')

        key_pem = self.db[enrollment_id]['PrivateKey']
        cert_pem = self.db[enrollment_id]['EnrollmentCert']

        private_key = load_pem_private_key(key_pem, None, default_backend())
        enrollment = Enrollment(private_key, cert_pem)

        user = User(enrollment_id, org, state_store)
        user.enrollment = enrollment
        user.msp_id = msp_id
        user.cryptoSuite = crypto_suit

        return validate(user)
    def create_user(self, enrollment_id, org, msp_id, state_store=None):
        """ Returns an instance of a user whose identity
            is stored in the InMemoryWallet
        """
        crypto_suit = ecies()

        if not self.exists(enrollment_id):
            raise AttributeError('"user" does not exist')

        user = User(enrollment_id, org, state_store)
        user.enrollment = self._Map[enrollment_id]
        user.msp_id = msp_id
        user.cryptoSuite = crypto_suit

        return validate(user)
Example #3
0
    def create_user(self, enrollment_id, org, msp_id, state_store=None):
        """Returns an instance of a user whose identity
            is stored in the InMemoryWallet

        :param enrollment_id: enrollment id
        :param org: organization
        :param msp_id: MSP id
        :param state_store: (Default value = None)
        :return: a validated user object
        """
        crypto_suit = ecies()

        if not self.exists(enrollment_id):
            raise AttributeError('"user" does not exist')

        user = User(enrollment_id, org, state_store)
        user.enrollment = self._Map[enrollment_id]
        user.msp_id = msp_id
        user.cryptoSuite = crypto_suit

        return validate(user)