Example #1
0
    def seal_private_key(cls, key_str, password):
        """
      Seal data with the password
      """
        import syndicate.syndicate as c_syndicate

        rc, sealed_data = c_syndicate.password_seal(key_str, password)
        if rc != 0:
            raise Exception("Failed to seal data with password: rc = %s" % rc)

        return sealed_data
Example #2
0
 def seal_private_key( cls, key_str, password ):
    """
    Seal data with the password
    """
    import syndicate.syndicate as c_syndicate
    
    rc, sealed_data = c_syndicate.password_seal( key_str, password )
    if rc != 0:
       raise Exception("Failed to seal data with password: rc = %s" % rc)
    
    return sealed_data
Example #3
0
def create_sealed_and_signed_blob( private_key_pem, secret, data ):
    """
    Create a sealed and signed message.
    """
    
    # seal it with the password 
    logger.info("Sealing credential data")
    
    rc, sealed_data = c_syndicate.password_seal( data, secret )
    if rc != 0:
       logger.error("Failed to seal data with the secret, rc = %s" % rc)
       return None
    
    msg = syndicate_crypto.sign_and_serialize_json( private_key_pem, sealed_data )
    if msg is None:
       logger.error("Failed to sign credential")
       return None 
    
    return msg 
Example #4
0
def create_sealed_and_signed_blob(private_key_pem, secret, data):
    """
    Create a sealed and signed message.
    """

    # seal it with the password
    logger.info("Sealing credential data")

    rc, sealed_data = c_syndicate.password_seal(data, secret)
    if rc != 0:
        logger.error("Failed to seal data with the secret, rc = %s" % rc)
        return None

    msg = syndicate_crypto.sign_and_serialize_json(private_key_pem,
                                                   sealed_data)
    if msg is None:
        logger.error("Failed to sign credential")
        return None

    return msg